I have a script that automates a tedious part of my job which involves a lot of repeated mouse clicks with decent sleep sections so that I can see if anything has changed in different windows.
1 - It currently is working spot on apart from if I send the loop stop hotkey it will continue the loop until the end before stopping - which as you can see from all the sleeps can take a wee while - I'm guessing this is because the loop only checks for the stop flag once per cycle - is there a way to get it to constantly check for this flag and exit if found to be active?
2 - I've been playing with the pause toggle command and it does work to pause the script but my tooltips are not elegant and depending at the point in the loop it pauses the tooltip can be immediately overwritten - I'd really like a tooltip showing a 'Pause On' and 'Pause off' as well as the existing tooltips within the loop indicating location within the loop / program- is this possible?
Much love
Code: Select all
^g::
$stop := 0
Loop,
{
Tooltip, Script is still running G18 to quit G16 to pause- Currently Level 1
Click 114, 685
Sleep, 3000
Click 186, 82
sleep, 3000
Click 1176, 161
sleep, 3000
Click 1176, 161
sleep, 60000
Tooltip, Script is still running G18 to quit G16 to pause- Currently Level 2
Click 131, 701 ; Click on TS l2
Click 186, 82
sleep, 3000
Click 1176, 161
sleep, 3000
Click 1176, 161
sleep, 60000
if ($stop)
{
return
}
}
^f::
$stop := 1
Tooltip,
Return
^d::
Pause
Suspend
Tooltip, Pause button pressed
return