我需要在执行.AHK文件的同时在单独的.txt文件中显示执行过程,所以如果在执行脚本时发生任何错误,它应该在.txt文件中显示。
< / LI>在运行脚本时,脚本应附加到新的.txt文件,而新的.txt文件需要显示日志信息(执行过程)。
以下是我的代码:
#SingleInstance force
#Persistent
Run, C:\Pangaea\Software\SVN\TortoiseSVN-1.8.8.25755-x64-svn-1.8.10.msi
SetTimer, Check, 1000
return
Check:
SetControlDelay -1
IfWinActive, ahk_class MsiDialogCloseClass, &Next
ControlClick, &Next, ahk_class MsiDialogCloseClass
IfWinActive, ahk_class MsiDialogCloseClass,Remove Installation
ControlClick, Remove Installation, ahk_class MsiDialogCloseClass
IfWinActive, ahk_class MsiDialogCloseClass, &Remove
ControlClick, &Remove,ahk_class MsiDialogCloseClass
IfWinActive, ahk_class MsiDialogCloseClass, &Finish
ControlClick, &Finish,ahk_class MsiDialogCloseClass
IfWinNotExist, ahk_class MsiDialogCloseClass
ExitApp
答案 0 :(得分:0)
此AutoHotkey脚本将记录每个脚本的成功/失败 这个过程的一步。
#SingleInstance force
#Persistent
Run, C:\Pangaea\Software\SVN\TortoiseSVN-1.8.8.25755-x64-svn-1.8.10.msi
vPath = %A_Desktop%\z log %A_Now%.txt
SetTimer, Check, 1000
return
Check:
SetControlDelay -1
vN := vRI := vR := vF := "success"
IfWinActive, ahk_class MsiDialogCloseClass, &Next
ControlClick, &Next, ahk_class MsiDialogCloseClass
else
vN := "ERROR"
IfWinActive, ahk_class MsiDialogCloseClass,Remove Installation
ControlClick, Remove Installation, ahk_class MsiDialogCloseClass
else
vRI := "ERROR"
IfWinActive, ahk_class MsiDialogCloseClass, &Remove
ControlClick, &Remove,ahk_class MsiDialogCloseClass
else
vR := "ERROR"
IfWinActive, ahk_class MsiDialogCloseClass, &Finish
ControlClick, &Finish,ahk_class MsiDialogCloseClass
else
vF := "ERROR"
vOutput := A_Now "`t" vN " " vRI " " vR " " vF "`r`n"
FileAppend, %vOutput%, *%vPath%, UTF-8
IfWinNotExist, ahk_class MsiDialogCloseClass
ExitApp