My problem is
I have a button (Button1). When this button is pressed, two things can happen
Option1 - The window with the button is closing (Win1)
Option2 - Another window - (Win2) - is opening (over the Win1).
One way is to wait, a number of seconds, that the Win1 is to be closed.
But, if Win2 has opened, Win1 will never be closed.
Is the best way, to write a loop to make the solution?
Code: Select all
MessID = ahk_class ______ ahk_exe _______.exe ; Win1
ControlClick Button1, %MessID% ; Press the "Exit" button
Loop 5000
{ IfWinExist Win2 ; If Win2 is opened
{ Do .....
}
else {
IfNotWinExist %MessID% ; Win1 is closed
Do ....
}
If A_Index = 5000
MsgBox Nothing was happening under all 5000 loops
}