20081104
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
]
開始行:
' ファイルシステムオブジェクトを取得する。
Set fso = WScript.CreateObject("Scripting.FileSystemObjec...
' 日付の生成
yDate = year(now())
moDate = Right(00 & Month(now()), 2)
daDate = Right(00 & Day(now()), 2)
hoDate = Right(00 & Hour(now()), 2)
miDate = Right(00 & Minute(now()), 2)
if miDate = 00 then
hoDate = Right(00 & Hour(now()), 2) -1
miDate = "59"
else
miDate = Right(00 & Minute(now()), 2) -1
end if
strDate = yDate & moDate & daDate & hoDate & miDate
'
' ディレクトリを指定
chkDir = "C:\Documents and Settings\PT4\デスクトップ\test\"
' エラーメッセージ
errMsg = "エラーが発生しています!"
' ファイル名を指定
errLog = chkDir & strDate
' 音声ファイルの指定
strSoundFile = "C:\WINDOWS\Media\Windows XP Ringin.wav"
' ファイルの存在を確認する
If FileExists( errLog & "*" ) Then
set objectShell = CreateObject("wscript.Shell")
strCommand = "sndrec32 /play /close " & chr(34) & str...
objectShell.Run strCommand, 0, True
errNow = Now()
WScript.Echo errMsg,"(",errNow,")"
End If
' オブジェクトの開放
Set fso = Nothing
Function FileExists(Spec)
Dim fso
Dim ParentFolderName
Set fso=CreateObject("Scripting.FileSystemObject")
ParentFolderName=fso.GetParentFolderName(Spec)
If ParentFolderName="" Then ParentFolderName="."
On Error Resume Next
fso.CopyFile Spec,ParentFolderName
'fso.MoveFile Spec,ParentFolderName
FileExists=Err.Number<>53
End Function
終了行:
' ファイルシステムオブジェクトを取得する。
Set fso = WScript.CreateObject("Scripting.FileSystemObjec...
' 日付の生成
yDate = year(now())
moDate = Right(00 & Month(now()), 2)
daDate = Right(00 & Day(now()), 2)
hoDate = Right(00 & Hour(now()), 2)
miDate = Right(00 & Minute(now()), 2)
if miDate = 00 then
hoDate = Right(00 & Hour(now()), 2) -1
miDate = "59"
else
miDate = Right(00 & Minute(now()), 2) -1
end if
strDate = yDate & moDate & daDate & hoDate & miDate
'
' ディレクトリを指定
chkDir = "C:\Documents and Settings\PT4\デスクトップ\test\"
' エラーメッセージ
errMsg = "エラーが発生しています!"
' ファイル名を指定
errLog = chkDir & strDate
' 音声ファイルの指定
strSoundFile = "C:\WINDOWS\Media\Windows XP Ringin.wav"
' ファイルの存在を確認する
If FileExists( errLog & "*" ) Then
set objectShell = CreateObject("wscript.Shell")
strCommand = "sndrec32 /play /close " & chr(34) & str...
objectShell.Run strCommand, 0, True
errNow = Now()
WScript.Echo errMsg,"(",errNow,")"
End If
' オブジェクトの開放
Set fso = Nothing
Function FileExists(Spec)
Dim fso
Dim ParentFolderName
Set fso=CreateObject("Scripting.FileSystemObject")
ParentFolderName=fso.GetParentFolderName(Spec)
If ParentFolderName="" Then ParentFolderName="."
On Error Resume Next
fso.CopyFile Spec,ParentFolderName
'fso.MoveFile Spec,ParentFolderName
FileExists=Err.Number<>53
End Function
ページ名: