I have a loop that may sometimes run for up to 8 hours, processing data. While it was running, I noticed some of my data extraction was not correct. Under these circumstances, I would like a method to escape the loop, but have the routine continue on from the code after the loop. So I figure I need some kind of keypress or something.
A potential issue I see is that the script is pressing keys periodically anyway! And moving mouse pointers etc. There are moments in the script where it is downloading data, so I suppose I could have that as a window of opportunity.
What is the best way to achieve this escape of loop, given the above?
I’d probably have the loop check the value of a variable like
Then I’d have another macro set the value of
skipLoop to “TRUE”.
Make certain the variable is zeroed-out appropriately afterward.
So the other macro always waits for a certain key to be pressed and that sets a global variable to TRUE? Then the loop in the other macro checks that variable? So when I start my script, it would always run another macro simultaneously?
Not wait in the sense of the “Pause Until” action, but your Skip Loop macro would be triggered by a hotkey, whatever you’d like.
Your main macro would check a variable on each iteration to see if its value was “TRUE”. (The variable normally would be empty or “FALSE”.)
Your secondary macro would do nothing more than set the value of the variable to “TRUE”.
If the variable condition is “TRUE” then you break out of the loop.