我正在尝试使用某种脚本,因此每5分钟检查两个文件,以检查它们是否已更新/更改/已修改。
如果文件1已更新/更改/已修改,则应执行一项操作,如果文件2已更新/更改/已修改,则应关闭某个程序并启动新程序,然后更改程序标题并移动它到0,0(屏幕的左上角)
我不知道怎么做的部分是检查文件以查看它们是否已被更新/更改/修改过。
有人可以帮助我并指出我正确的方向吗?
提前致谢:)
答案 0 :(得分:2)
您正在寻找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