Allow a Macro to Pass Through its Hotkey (Keyboard Shortcut)

Hi all,
this is my first post. Greetings to all forum members :wave:
I was a long time Quickeys user and started to migrate to KM a few month ago because I wanted to everything 64-bit ready. It was quite a learning curve and reading in this forum helped a lot in finding solutions. All I need works already and I'm mostly refining old and checking new ideas.

Here's my question:
Can I re-use the Hot Key Trigger in my macro?
I have some macros that depending on conditions have to type/keystroke the hot key they were triggered from. I know I can just put the respective keystroke into an action, but I want to have it more universal, so I can copy-paste the same if-else-action into different macros without changement.

1 Like

Hey @Flix,

Welcome to the forum!  :smile:

Yet another QuicKeys refugee...

I gave QK up in 2012 if I remember correctly. I had the advantage of running Keyboard Maestro concurrently for about 8 years, but the conversion process was still quite laborious – something over 1,000 macros – many of which were very complex. Then too the radical differences between QK's and KM's design paradigms made that road even more bumpy.

QuicKeys was most excellent at keeping its keyboard shortcuts from interfering with macro execution. It was no problem at all to let a QK macro pass the same keyboard shortcut it used to execute through to the macOS or an app.

Keyboard Maestro doesn't handle this quite so magically as QK, but you can do it.

Test Keyboard Shortcut Repeated by Macro.kmmacros (1.8 KB)

This kind of thing is not really recommended though, because there's a possibility of unintended side-effects.

Were I to employ this technique I'd probably go the extra mile and add a Semaphore Lock action to the macro.

Test Keyboard Shortcut Repeated by Macro v2.0.kmmacros (5.9 KB)


1 Like

DON'T forget to disable the above macro after you test it.

It'll get in the way right quick.


Hey Chris, thanks for your answer.
Sure I can insert the keystroke action, but I'd have to adapt it in each macro, which I wanted to avoid.
I didn't know this semaphore thing, good to know.
In the meantime I found some options in KM's "Insert Token" options which helped me to do what I wanted:

Bildschirmfoto 2021-01-09 um 16.55.42

"Tripped Trigger Value" is what I needed.

1 Like

Cool beans!  :sunglasses:


Hey @Flix,

How are you using that to pass the Hotkey through?

As far as I know there's no way to turn the text from the token into a pressed key chord...

I think I could cobble together something using AppleScript and System Events, but I don't know of a way using Keyboard Maestro.


The background is this:
I have a set of macros that are triggered from hot keys without modifiers, for example 1,2,3,.. and letters.
The application uses very little text, but if I'm in a text field I want to type the characters, not trigger the macro.
After letting the macro check for text conditions I can now replicate my trigger with %TriggerValue%. This works for triggers without modifiers. Good for now.
In the future I my want to use triggers with shift modifier, but I get unexpected result when testing.