loop, read, c:\storefile.txt
{
store_select := A_index - 1
sleep, 1000
gosub, selectstore
gosub, login
gosub, makeandorrunreport
gosub, Emailreport
getout: ; label pointer for logging out and moving on
gosub, logout
gosub, startprism
}
pause
如果它挂在我的一个子程序中,我想中断该脚本,并从我的getout标签继续。
类似于暂停切换,可以让我在暂停结束后更改线程的执行点。
这可能吗?
答案 0 :(得分:0)
您可以使用try / catch,当捕获到错误时,运行您在其他位置预先编写的单独脚本,然后删除原始脚本。
示例:强>
try ; Attempts to execute code.
{
loop, read, c:\storefile.txt
{
store_select := A_index - 1
sleep, 1000
gosub, selectstore
gosub, login
gosub, makeandorrunreport
gosub, Emailreport
getout: ; label pointer for logging out and moving on
gosub, logout
gosub, startprism
}
pause
}
catch e ; Handles the first error/exception raised by the block above.
{
Run, Script\from\separate\location.ahk ; Run script from somewhere else.
ExitApp ; Kill off the current script.
}