Multiple actions from one hotkey

Hi I am testing this program having used Karabiner.

One of the features that I liked was the following
tap F6 Action 1
Hold F6 Action 2
Double Tap F6 Action 3

I have loosely set it up however when I try the double or the hold (press down) the first action still activates.

What is the work around for this? Also For other keys like =/*+ if hold to do an action I would need to prevent the multi keystroke in textfields showing.

Karabiner and Keyboard Maestro are very different tools. Karabiner is a low level keyboard remapping tool.

Keyboard Maestro has hot key triggers that can handle tap and double tap. However, as you note, a tap happens before a double tap. Obviously, since Keyboard Maestro cannot know the future, at the time of the tap, there is no way to tell if you are going to tap again. The only way to do that would be for the tap to not trigger immediately, to wait and see what happens next, and then to trigger if no further action happens. This would introduce undesirable delays in handling the first tap if it was used generally. However, you can implement this yourself if desired. Two macros like this:

  • Macro One Trigger on F6 tapped once

  • Actions:

    • Set variable “Do One” to 1
    • Pause (desired amount of time)
    • If variable “Do One” is 1 then
      • Perform actions
  • Macro Two Trigger on F6 tapped twice

  • Actions:

    • Set variable “Do One” to 0
    • Perform actions

Keyboard Maestro has no concept of “Hold”. It can trigger a macro repeatedly while a key is held down.

For keys like =/*+, if they are used as hot keys, then they will be swallowed, so they cannot type keys into text fields.

1 Like

Thanks for the prompt reply I have a lot to learn, I believe above has open new possibilities for me

However I'm still not getting it,


This is my key so far.

Matt

In the Set Variable action, just put “1” in the “to” section.

Remove the Execute Rotate 270 action, and that is macro 1 done.

Then create a second macro, hot key trigger F6 tapped twice, actions:

  • Set variable “Do One” to “0”
  • Execute Rotate 270

Got it!
Many thanks for you help
If I want to add a third etc? so three taps is that possible?

See MACRO: HotKey Multi-Press (Multi-Tap) Template

You could probably add a Switch or Case action (KM Wiki) to this macro based on the tap count.

1 Like

I like that! Thanks

I'm still convinced I might be able to simulate the behaviour Im looking for in terms of a holiding key combined with a double tap. and normal behaviour

This is what I have so far, but the result is I get 2 keystrokes at the end.

Holding Key an multiple presses.kmmacros (25.3 KB)

Ok I think this appears to work, Thank you to JMichaelTX for his original Macro.

This currently appears to work as I used to use it with karabiner.

I just need to place actions in and test it.
Matt

1 Like

Hello everyone! i'm super new in keyboard maestro and trying to figure out how this script works. I have two actions for my DAW, and I would like to switch between that actions with one button, I will be very grateful for the detailed instruction, thank you!

Hi @tvsilence,

I think a macro like this is what you're trying to accomplish:

Switch DA Actions.kmmacros (4.7 KB)
15 PM

Instead of an If Then Else action, this macro uses the Switch/Case action, which essentially lets you use multiple If Then Else conditions in a single action. This way, if the variable used to control which of your DAW macros is executed doesn't exist (which it won't the first time you run the macro unless you explicitly create it elsewhere) this macro will create the variable and execute the first macro (or at least, it will once you replace the placeholder actions with the appropriate "Execute Macro" actions).

While this is all well and good on its own, the key to having a macro like this work as intended is to make sure that each macro it executes sets the same variable to the value used for the other macro the next time the macro is run. In other words, your #1 MIDI ROLL UP macro should end with an action like this:

51 PM

And your #2 MIDI ROLL DOWN macro should end with an action like this:

35 PM

The variable and values you use don't need to be the same as these examples, but they do need to follow this pattern, where the same variable is referenced/used in each macro, and its value changes appropriately whenever the two DAW macros are executed. Make sense? Feel free to post again if you have any further questions.

1 Like

Thank you so much for such a detailed answer! I’m new in KM and here on the forum, but i I feel so comfortable in this community, you guys are very responsive, thank you once again.

1 Like