I want multiple sofware pop up boxes to automatically close. Works for the first "Warning" window but not the next.
Code: Select all
{
WinWait, Warning
WinClose, Warning
}
Loop
{
WinWait, information
WinClose, information
}
Code: Select all
Code: Select all
Code: Select all
Code: Select all
GroupAdd, Unwanted_Windows, Warning
GroupAdd, Unwanted_Windows, information
Loop
{
WinWait, ahk_group Unwanted_Windows
WinClose
}
So using groups it loops automatically without having to write the sequence manually?Alibaba wrote: ↑03 Aug 2019, 07:04Hello hannahelappin,
just to clarify a bit why your current solution is not working: Your script will never leave the first loop, so the second loop is “dead code”.
A (unconditional) loop like you are using will only be exited by instructing the script to do so. Take a look at the break statement.
I recommend GEVs solution.
Well you could think of it like that if it makes it easy to understand, but how WinWait does this internally depends on its implementation in the AHK source code. Using a loop to repeatedly check a condition is called busy waiting (link fyi) but I guess that WinWait is based on system events instead. You should avoid busy waiting whenever possible. (While again this doesn't always apply for low-level programming and use cases )
Busy waiting or... a gameAlibaba wrote: ↑03 Aug 2019, 11:03Well you could think of it like that if it makes it easy to understand, but how WinWait does this internally depends on its implementation in the AHK source code. Using a loop to repeatedly check a condition is called busy waiting (link fyi) but I guess that WinWait is based on system events instead. You should avoid busy waiting whenever possible. (While again this doesn't always apply for low-level programming and use cases )