I have a pixel color comparison loop to check a few pixels but sometimes the web page didn't load resulting in a dead lock in the loop. I need to time out the loop and then press the "refresh" button to get the page to reload and hopefully the right pixel condition will end the loop.
Any idea how to "time out" a loop in say 60 seconds?
It really depends on what logic you are using to do your looping; it will be different for the FOR loop's or looping based on conditions.
Generally you can't go wrong with a counter to control your looping
Something loosely like this for your 'time out' at 60 seconds:
(opening macro lines) 10 | FOR | EACH | LINE IN | D:\Macro\pixel events.mmmacro | RUN 11 | RUN ACTION | | | | WAIT SECONDS | 1 12 | RUN ACTION | DEFINE INTEGER VARIABLE | %INTEGER%::+1 13 | IF | INTEGER VARIABLE | %INTEGER% | < | 60 | GOTO MACRO LINE | 10 14 | FOR | EACH | LINE IN | D:\Macro\page refresh events.mmmacro | RUN 15 | IF | STRING VARIABLE | %STRING% | IS NOT | END | GOTO MACRO LINE | 10 (closing macro lines) - at line 10 we do the pixel conditions, loaded in using a FOR RUN condition - lines 11, 12, and 13 is our counter. We add +1 to INTEGER every loop. When we get INTEGER above 60 we move on to line 14 - line 14 we run the 'refresh' you need for the page, again in a FOR RUN condition. - and line 15, if we didn't declare STRING to END we then go back to line 10 and continue the loop
Thanks Steve for your help! This is exactly what I want and I have thought of doing something like this too. The wait 1 sec line is the key. I was hoping there is a timer function somehow without using a counter. This is a great example Steve!