Thank you very much for your help
There may be much better ways to do this, but here's the first one that came to my mind:
Download Macro(s): Pause until 2x control key.kmmacros (4.3 KB)
Macro notes
- Macros are always disabled when imported into the Keyboard Maestro Editor.
- The user must ensure the macro is enabled.
- The user must also ensure the macro's parent macro-group is enabled.
System information
- macOS 14.7.5
- Keyboard Maestro v11.0.3
The delay between the two Until actions is needed to make the second one not fire on the first press of the key; you can vary the delay as needed for your typing speed.
Note that this may not be the ideal solution, as it will act on two presses of the Control key separated by any amount of time—days, even. You could work around that by wrapping it all in some sort of timer function, where it times out if the second key isn't pressed within some amount of time, and then restarts the waiting. But I leave that as an exercise for others, as I don't have a ton of time this morning :).
-rob.
great ! thank you very much !
Generally, if you want to pause until a key press, the best way to do this is to use a disabled macro that is triggered by the key press that sets a variable value to true and then disables itself.
Then the parent macro does something like:
- Set the variable to false
- Enable the other macro
- Pause until the variable is true
You can use the USB Device Key trigger to detect a double tap of the control key, or if you want to allow the control key to be pressed twice separately, you could have the sub macro not disable itself and increment a counter, and the parent would then:
- Set the variable to 0
- Enable the other macro
- Pause until the variable is >= 2
- Disable the other macro
The reason for this is that triggers will detect very fast key presses while Pause Until or other such conditions will only detect the key press if it is held down long enough.
I will give it a try. thank you very much @peternlewis