How to detect an unpredictable pop-up window
How to detect an unpredictable pop-up window
I use FindText to find some patterns and click on them in a loop to do some boring stuff, normally it works perfectly, except occasionally an window pop up and bolcks the patterns causing the loop cann't continue.I wonder if there is a way to detect the window when it pop up simply close it.
Re: How to detect an unpredictable pop-up window
Take a look at the #1 example for SetTimer
Re: How to detect an unpredictable pop-up window
Thanks, but I don't know where to place the SetTimer code in the loop.I tried something below, but seems not working.
loop, % counter
{
SetTimer, CloseMailWarnings, 250
return
FindText(A)
do something
}
CloseMailWarnings:
WinClose, window_A
return
Re: How to detect an unpredictable pop-up window
The SetTimer statement doesn't go in a loop. The timer is what makes the code get executed repeatedly. The loop for your own code can follow it, but the SetTimer doesn't go inside it. It would be something like this:
Code: Select all
#Persistent
SetTimer, ClosePopups, 250
loop, % counter
{
FindText(A)
do something
}
return ; marks the end of the auto-execute section
ClosePopups:
WinClose, window_A
return
Re: How to detect an unpredictable pop-up window
Thanks for your help. Since it takes nearly 3 hours to finish the loop, it seems SetTimer is not suitable inside a loop.
Re: How to detect an unpredictable pop-up window
You set the timer to execute every 5 seconds (or however often you want)
Checking for any of your popups should be very lightweight and take less than 1ms so while your main loop can take 3 hours or however long it takes, your timer is constantly checking and closing the popup(s)
Re: How to detect an unpredictable pop-up window
Thanks, is the change like that will do the job?Chunjee wrote: ↑07 Oct 2019, 13:36You set the timer to execute every 5 seconds (or however often you want)
Checking for any of your popups should be very lightweight and take less than 1ms so while your main loop can take 3 hours or however long it takes, your timer is constantly checking and closing the popup(s)
Code: Select all
#Persistent
loop, % counter
{
SetTimer, ClosePopups, 250
FindText(A)
do something
}
return ; marks the end of the auto-execute section
ClosePopups:
WinClose, window_A
return
Re: How to detect an unpredictable pop-up window
No, I told you that the SetTimer command doesn't go in he loop. Make it just like I had it with the SetTimer before the loop. You can change it from 250 to 5000 if you'd like to have it check every 5 seconds instead of every quarter of a second. But either way, put it before the loop. Why do you keep insisting on putting it in the loop? That is wrong.
Who is online
Users browsing this forum: marypoppins_1, skeerrt and 134 guests