1
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 标签继续。

类似于暂停切换的东西,一旦暂停结束,我就可以更改线程的执行点。

那可能吗?

4

1 回答 1

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.
}
于 2017-09-09T17:45:00.943 回答