Hallo,
The manual says about WinWaitClose:
https://www.autohotkey.com/docs/v1/lib/WinWaitClose.htm#Remarks
But that obviously doesn't always work!:While the command is in a waiting state, new threads can be launched via hotkey, custom menu item, or timer.
Code: Select all
#Requires AutoHotkey v1.1.33
#Persistent
DetectHiddenWindows, On
one() {
SoundBeep, 4000, 20
}
two() {
SoundBeep, 1000, 20
WinWaitClose, ahk_id %A_ScriptHwnd%
}
SetTimer, one, 1000
SetTimer, two, 2000
Code: Select all
#Requires AutoHotkey v2.0
Persistent
DetectHiddenWindows True
one() {
SoundBeep 4000, 20
}
two() {
SoundBeep 1000, 20
WinWaitClose "ahk_id " A_ScriptHwnd
}
SetTimer one, 1000
SetTimer two, 2000