此代码显示消息框:
Msgbox, Hello
SetTimer, CheckTime, 1000 ; updates every 1 second
CheckTime:
Return
但这不是:
SetTimer, CheckTime, 1000 ; updates every 1 second
CheckTime:
Return
Msgbox, Hello
这是为什么?我没有看到SetTimer命令有什么特别之处。
只要找到第一个Return
关键字,脚本就会停止执行新行。
第一个顶级Return
之后的所有内容将在初始执行时被忽略,除非它已从上面的行调用。
看看这段代码:
MsgBox, I'll run!!!
MsgBox, Me 2!!!
Gosub, PastReturn
overPastReturn()
MsgBox, Me 5!!!
Return ; This is the first Top Level Return. Code Stops Executing Here.
MsgBox, Not Me!!!
PastReturn:
MsgBox, Me 3!!!
Return ; This Return Belongs to PastReturn Label.
MsgBox, Not Me 2!!!
overPastReturn(){
MsgBox, Me 4!!!
}