我SetTimers
指向多个标签,但当其中一个标签中有WinWait
时,它们就会停止工作。
SetTimer, MyLoop, -5
SetTimer, MyLabel, -1000
Return
MyLoop:
SoundBeep, 700
SetTimer, MyLoop, -5
Return
MyLabel:
SoundBeep, 300
WinWait, Notepad
SetTimer, MyLabel, -1000
Return
MyLoop
到达MyLabel
部分后, WinWait
停止工作。如果MyLoop
正在等待MyLabel
,我该如何继续WinWait
?
答案 0 :(得分:0)
请参阅文档:Threads,SetTimer,WinWait
i := 0
settimer, afterTenMsg, 1000 ; Start our timer!
GoSub, WaitForNotepad
ExitApp
WaitForNotepad:
WinWait, Untitled - Notepad ; This Thread is interupted by the Timer.
MsgBox % "Yeah NotePad Opened!" ; Close this will return to line 3
return
afterTenMsg:
i++
if (i == 10) {
settimer, afterTenMsg, off
run, notepad.exe
settimer, openMsgBox, 1000 ; Interupt MsgBox thread after 1 sec
}
return ; Returns to WinWait
openMsgBox:
settimer, openMsgBox, off
MsgBox % "We interupted a MsgBox!" ; close this will return to line 8
return
希望这有帮助。