News:

Welcome to our NEW forum! We invite you to sign up today
so it can grow to be a valuable resource to all Toolbox users!

Main Menu

Auto-clicker

Started by oblivion, March 30, 2026, 04:41:57 AM

Previous topic - Next topic

Paul (Lead Developer)

It fails in a forever loop if you don't use the Esc key test after the macro (using "Action: Do next step if "{esc}=1" after the macro).

Pressing Esc only appears to work in a finite test of 5000 (or even 50000) repetitions because those loops end pretty much immediately... so it's not Esc stopping them, but the loop ending naturally. A loop of 50000 is over extremely quickly, and I think you're assuming that pressing Esc is what's ending it (it's not). You can see for yourself with this and check the Log tab when the action ends; it'll show 49999 which means Esc isn't what stopped it. Esc stopping it should show a much lesser number.

(Start)
HOW TO USE: Copy from Start to End, and then paste into an action.
REFERENCE : See an example of pasting at alomware.com/paste.png
0001 Action: Repeat this block "50000"
0002  Macro: Type keys or use mouse "{@1500,35}{leftclick}{z25}"
0003 Action: End of block ""
0004 Log: Add text "repeat$"
(End)

oblivion

I'll try the logging thing.

But unless the clicks are getting buffered in some way, a loop of 5000 takes a noticeable amount of time to complete. 5000 clicks x 25 milliseconds is 125 seconds, or just over 2 minutes. I can terminate a 5000 loop after 5 seconds with a single Esc and it'll stop. If I try to terminate a forever loop without a test for Esc by pressing the Esc key, even after 5 seconds, it'll continue indefinitely -- which is what's happening with the update, even by holding Esc down. (The only way out of a forever loop without a test is to hold Esc down then right-click on Toolbox and exit without letting go of the Esc key.)

But I really have to go now. I understand what you're saying but I don't think it quite aligns with what's actually happening. I'll try to get back to this tomorrow.

Paul (Lead Developer)

Okay, I worked it out. It was a wrongly-used failsafe code for the Esc key when a macro starts, which shouldn't really be there (sometimes I go overboard with checking the safety of things). Now that I've removed it, you can no longer incorrectly terminate your 5000 loop anymore with this code (which is logically correct):

(Start)
HOW TO USE: Copy from Start to End, and then paste into an action.
REFERENCE : See an example of pasting at alomware.com/paste.png
0001 Action: Repeat this block "5000"
0002  Macro: Type keys or use mouse "{@1500,35}{leftclick}{z25}"
0003 Action: End of block ""
(End)

To currently correctly terminate this action early with the Esc key, it has to be done like this:

(Start)
HOW TO USE: Copy from Start to End, and then paste into an action.
REFERENCE : See an example of pasting at alomware.com/paste.png
0001 Action: Allow failure messages "0"
0002 Action: Repeat this block "5000"
0003   Macro: Type keys or use mouse "{@1500,35}{leftclick}{z25}"
0004   Action: Continue if "{esc}=0"
0005 Action: End of block ""
(End)

This is the correct way. This change will be in the next Toolbox release.

oblivion

OK, thanks Paul, sorry it's taken a while to get back to this. I can confirm that I've ensured my code follows the requirements for forever loops and it's now completely consistent and completely solid.