Multi-Press Macros

Hotkeys & USB Device Keys

Macros & Notes

Hotkey-USB - Press Detection.kmmacros (70 KB)

Macro screenshot

Hotkey-USB (Caller Template).kmmacros (34 KB)

Macro screenshot

  • The Caller serves as a template for your macros that can be duplicated. The Press Detection macro is a subroutine that all callers will reference.

  • You will need to set two triggers per hotkey or USB Device Key in the Caller macro. One for is pressed and one for is released.

Options:

  • Trigger: Leave this as it is.

  • Multiple Taps:

    • Sets the number of multiple taps to detect.
    • The maximum is 5. This could be increased by adjusting the submacro.
    • If this value is left blank or set to less than 2, then multiple taps will not be detected. This is recommended if you only want to detect short/long presses, as it will make things slightly more responsive.
  • Long Press:

    • If this is set to any value except 0 or No, then long presses will be detected.
  • Tap Gap:

    • This sets the maximum length of the gap between multiple taps. Increase this value if you would like slower taps to be accepted.

Stream Deck: KM Link Plugin

Macros & Notes

KM Link - Press Detection.kmmacros (50 KB)

Macro screenshot

KM Link (Caller Template).kmmacros (42 KB)

Macro screenshot

  • NB: The Caller serves as a template for your macros that can be duplicated. The Press Detection macro is a submacro that all callers will reference.

  • You will need to select the Caller macro in KM Link's macro selection dropdown. If you add a Parameter value to the plugin, it will be accessible as Local__KMLinkParameter in the Caller.

Options:

  • Tap Speed:
    • This sets the maximum length of the gap between multiple taps. Increase this value if you would like slower taps to be accepted.
  • Multiple Taps:
    • Sets the number of multiple taps to detect.
    • The maximum is 5.

MIDI

Macros & Notes

MIDI - Multi-Press.kmmacros (77 KB)

Macro screenshot

MIDI - Short-Long Press (Snappy).kmmacros (40 KB)

Macro screenshot

  • Single/double/triple tap and long press templates.

MIDI - Detect Release (Leave Disabled).kmmacros (34 KB)

Macro screenshot

  • Momentarily watches for MIDI release triggers. Any MIDI multi-press macros you create from the above template will reference this single detection macro; there's no need to duplicate it.

Hold-to-Repeat

Macros & Notes

Repeat - Basic.kmmacros (31 KB)

Macro screenshot

  • Basic action repeat loop.

Hotkey - USB - Repeat.kmmacros (39 KB)

Macro screenshot

  • Repeats an action until the trigger is released, at which time another action can be triggered.

Hotkey - USB - Repeat (Speed Up).kmmacros (40 KB)

Macro screenshot

  • Repeats an action until the trigger is released, at which time another action can be triggered. The speed at which the first action repeats increases the longer the key is held.
14 Likes

@noisneil, these a really slick. Thanks to @DanThomas and you for sharing these techniques! :clap::clap:

1 Like

Just for reference, linking this 2014 thread from shortly after Double Tap Control was added.

1 Like

Oops... Just seen your comment now.

The limitation of tapped triggers that if, for example, you have one macro that triggers on tapped once and another on tapped twice, tapping twice will trigger both macros. The templates above are a neat way around that problem. :+1:t3:

Updated the original post to include a much improved version of the main Hotkey/USB Device Key version of the Multi-Press Template.

Updated the KM Link macros to be far more intuitive in terms of setup.

1 Like

Maybe I'm dense, but I can't seem to figure out how to change the timing of the long press interval to be longer, when using the USB Device Keys macro you've created.

In other words, I end up triggering the long press sometimes, when I'm just trying to use the short press, so I'd like to increase the timing a little longer so I don't accidentally trigger long press when pushing the button on my Stream Deck. But I can't seem to figure out how to increase the time required for long press to trigger. How do I correctly do that? Great macro, by the way.

Edit:

I swear I had tried it before, and it didn't seem to work at the time, but is it just as simple as changing the timeout interval in the "Wait for Release" section of the macro to something longer than 0.2 seconds? I just tried changing it to 1 full second, and it does seem to increase the interval to the point that I'm now no longer accidentally triggering the long press (maybe I'll try 0.5 seconds to see how that treats me). Is that all that is needed to adjust the the macro to behave as I require?

1 Like

Yep, that's all!

Worth bearing in mind that KM v11 introduced some new trigger options that do the same thing in most situations:

Are you saying that the sort of macro you created is no longer needed?

Not entirely, no, but in terms of simple hotkey/USB device key triggers, it will probably suit most users.

I have one macro that can do short and long press actions, based on whether it was triggered by a short press or a long press. I use your macro to discern whether a short press or long press was used, and then in turn do one set of actions or another, depending on the type of press.

I'm kind of wondering if the new native long press functionality you highlighted in KM 11 would be able to be used in the fashion that I described above. I'm sort of inclined to think I'd still need your macro for my particular use case, but maybe not?

Also, is the new native long press functionality in KM 11 able to be modified to a particular time interval, or does it have only one preset time interval, and you take it or leave it?

I'm sure you can use the native triggers for something as simple as that, yes.

You can use an if/else condition based on whether %Trigger% contains 'tapped' or 'pressed'.

You can set the tap detection time using the command line preferences:

https://wiki.keyboardmaestro.com/manual/Preferences#Hot_Key_Triggers

1 Like

Ah, yeah, I guess the %trigger% could work as a differentiator. I'll have to look into the command line thing. I haven't messed with that in KM before. I guess it's fairly simple.

10 posts were split to a new topic: How do you configure the long press time?