Closed bistabil closed 4 years ago
So far I've managed to repeat keystrokes indefinitely by reseting register's state.
I don't understand this, would you clarify?
Regular way would be to use $goTo
E.g.
$tapKey a
$tapKey b
$goTo 0
Since macros are executed asynchronously is there any way to stop them?
Yes, you can signal using a register.
E.g. InterruptionKey:
$setReg 5 1
Macro:
$setReg 5 0
$tapKey a
$tapKey b
$ifRegEq 5 1 break
$goTo 1
Also, there is a set of diagnostic commands which reset the keyboard state including hard interrupt of all running macros. But you do not want to use that.
I will test this today. So if I understood it, registers are not "created" for different instances of macros? I didn't expected this to be the case as macros themselves can run in parallel so I assumed that these registers would be created for each macro instance.
Correct. "registers" are simply global variables.
Also, thinking about it again, the shortest variant is probably to use the conditional for modifiers. This variant would not need any signaling via registers...
E.g.:
$tapKey a
$tapKey b
$ifAnyMod break
$goTo 0
And how about longer action sequences? Let's say that there are a lot of actions before $ifAnyMod break - commands such as delays and mouse movements. Is there another way to stop it other than using $ifAnyMod break after every action?
There is diagnose
, which will however do more than that and should not be used as a regular way.
But I think I can add a new command like stopAllMacros
. However, it might have to wait until situation around secondary roles is resolved.
Done.
Could you please test that it works as expected?
I've tested it while I was running a single macro and it worked!
Thanks!
So I guess this can be closed. (Ofc., feel free to follow up.)
Is this possible? Since macros are executed asynchronously is there any way to stop them? My use case is following: I want to repeat some keystrokes indefinitely or until I interrupt it manually. So far I've managed to repeat keystrokes indefinitely by reseting register's state. Actually I can interrupt it by powering off the keyboard but that's only way I've found.