• Demonstrate how to make use a long press of the hot key trigger to invoke optional processing in your macro
• This NOT a finished macro, ready for use in a production environment
• It is a teaching example to show you how to use this concept in your own macros.
Author: @JMichaelTX, @Tom, @DanThomas, others
• While I wrote this specific macro, the original idea/example was
posted by @Tom, and then @DanThomas. (see references below)
• Others may have pioneered this idea
HOW TO USE:
(1) Normal Use: Quickly press and release the Hot Key
(2) Optional Use: Press and hold Hot Key trigger for at least 0.5 sec
• You should hear a brief "Tink" sound
Change the Macro Hot Key Trigger to whatever you'd like
Then change the Action "CHECK FOR LONG PRESS" to use the same key and modifier key
Can this macro be called using the Execute Macro action?
To keep it as one macro and avoid duplicating it on every macro where I'd like to use a Long/Short press, would like to know if this macro can be used in a Execute Macro action, and somehow use with long and short key press detection.
I finally got around to trying out KM 10's new "long press" trigger, but was then a bit disappointed to learn that it's actually implemented as "long press and then release", which means you either have to keep the key pressed longer than necessary or you risk pressing it too short, because you will only know after you have released the key whether it was long enough or not.
The approach presented in this thread (and others) avoids this awkward uncertainty, but it suffers from another downside: Executing the actions after a short press is delayed by the "Pause" action, which makes them feel a bit laggy. This is not much of an issue for less frequently used macros, but I wanted to overload some of the hotkeys that I frequently use and for those, delaying the short press actions by 300-500ms was not an option.
It then occurred to me that I could reverse the logic for detecting short vs. long presses: Instead of waiting some time and then checking whether the key is still pressed, I could repeatedly check whether the key is no longer pressed and execute the short press actions as soon as the key is up:
This macro checks (roughly) every 50ms whether the key is up. If it is, the short press action is executed immediately and the macro is cancelled. If after (roughly) 8 x 50ms = 400ms the key is still not up, the long press action is executed.
I don't know if there is something that I'm missing that would make this approach not a good idea, but it seems to work really well for me.
I've managed to incorporate it into my Single/Double Tap & Long Press macro. It's slightly snappier than my previous method of detecting double presses, but has one drawback that may or may not bother you. Two single taps, which occur outside of the double tap window, but during the period the macro is listening for a long press, will be seen as a long press. In other words, if you want to do single taps in relatively quick succession, this ain't the macro for you. Perhaps there's a way to improve it, but I can't think of one.
Edit: I fixed the above issue, added the ability to choose what type of presses it will detect for, and added a triple-tap option because... why not?
I kept seeing the word "multipress" in your macro. My mind was repeating the word "multipress, multipress, multipress." Suddenly my brain remembered a video clip. Go to Youtube and search for "LEELOO DALLAS MULTIPASS". (It's just 23 seconds in length.)