|
|
folder = "C:\監視対象フォルダ"
fukidasi("監視中: " + folder)
monitor = GetFileEventMonitor(folder) while TRUE newfile = GetFileName(monitor.NextEvent()) if input("新しいファイルが書き込まれました", newfile) = EMPTY then break wend
fukidasi()
function GetFileEventMonitor(folder) query = replace(WQL, "%FOLDER%", replace(folder, "\", "\\\\")) with createoleobj("WbemScripting.SWbemLocator") result = .ConnectServer().ExecNotificationQuery(query) endwith fend
function GetFileName(event) name = betweenstr(event.TargetInstance.PartComponent, "CIM_DataFile.Name=<#DBL>", "<#DBL>") result = replace(name, "\\", "\") fend
textblock WQL SELECT * FROM __InstanceCreationEvent WITHIN 1 WHERE Targetinstance ISA 'CIM_DirectoryContainsFile' and TargetInstance.GroupComponent= 'Win32_Directory.Name="%FOLDER%"' endtextblock
|
No.1621 2015/08/29(Sat) 18:04:59
|