我正在尝试使某种脚本工作,因此它每5分钟检查两个文件,以检查它们是否已更新/更改/被修改。
如果文件1已被更新/更改/被修改,它应该做一件事;如果文件2已被更新/更改/被修改,则它应关闭某个程序并启动新程序,然后更改程序标题并将其移至0, 0(屏幕左上方)
我不知道该怎么做的部分是检查文件,以查看它们是否已被更新/更改/被修改。
有人可以帮助我,并指出正确的方向吗?
提前致谢 :)
您正在寻找FileGetTime
,尤其是将选项设置为0(已修改)
Func Timecheck()
$file1_2 = FileGetTime("C:\file1.txt", 0, 1)
$file2_2 = FileGetTime("C:\file2.txt", 0, 1)
If $file1_1 == $file1_2 Then
; Do something here if file 1 isn't modified within 5ins
EndIf
If $file2_1 == $file2_2 Then
; Maybe WinClose?
WinClose("programhere")
; Maybe ProcessClose
ProcessClose("process.exe")
; Launch your program...
Run(...)
; Wait for process
ProcessWait("process.exe")
; Wait for Program...
WinWait("programhere")
WinSetTitle("programhere", "", "newprogramhere")
WinMove("newprogramheret", "", 0, 0, 800, 600, 1)
EndIf
$file1_1 = FileGetTime("C:\file1.txt", 0, 1)
$file2_1 = FileGetTime("C:\file2.txt", 0, 1)
EndFunc
; Initial Launch, grab current GetTime
$file1_1 = FileGetTime("C:\file1.txt", 0, 1)
$file2_1 = FileGetTime("C:\file2.txt", 0, 1)
While 1
Sleep(300000)
Timecheck()
WEnd
参考:http : //www.autoitscript.com/autoit3/docs/functions/FileGetTime.htm
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句