How to prevent deactivating a running "Macro A" from a "Macro B" when "Macro B" uses an Application based Trigger?

Hey Folks !

I have something that drives me nuts....

Since I am remapping a lot of Shortcuts and use Keyboard Maestro Engine to enable and disable Macros and even Macro Groups like I need them to be available to me ONLY when I need them I ran into this:

  1. I have a Macro named Toggle Alfred which is a SubMacro of another Macro in my Global Macro Group.
  2. My second Macro called Alfred Helper which is in a Macro Group dedicated to Keyboard Maestro Engine since it uses an Application Launches & an Application Quits Trigger.

Here is the Case:

Macro No. 2 should wait until Macro No. 1 has finished:

  • Macro No. 1 is dedicated to:
    • launch Alfred
    • wait for running Alfred
    • deactivate its Main Macro (because of using Alfred's Trigger Shortcut as remapped Shortcut)
    • pressing ⌥ Space => Alfred's Trigger Shortcut
    • Pause 0.5 sec
    • reactivating the Main Macro
    • Cancel

My Fault is that Macro No. 2 disables Macro No. 1 when it detects Alfred as "Running" - so that Macro No. 1 has no chance to continue like I want it to do....

Maybe someone can help me out with that ??!!

Many Greetings and a big THANK YOU from Germany


I'm not sure I completely understand the issue, but when you're dealing with timing issues between macros, the action Semaphore Lock often helps.

Have the first macro lock a semaphore at the start. The semaphore will automatically be unlocked when the macro finishes.

Have the second macro try to lock the same semaphore. It will wait until the semaphore is unlocked by the other macro. You can adjust the timeout if you need to.

Hope this helps.

1 Like

Thank you for your quick answer @DanThomas ,

I've placed a Semaphore Lock at the beginning of both Macros - which looks like this, when not collapsed (what I prefer):


Did I name the Semaphore correctly? - Or should I name it like my Macro ?

Yust forget my Question :see_no_evil::see_no_evil: ==> It works..... will mark your Answer as Solution!!

Many Many Thanks :pray::pray::pray::pray::pray::pray:

Greetings from Germany


1 Like

Looks good to me, and the name's good. It should work just fine.

Good job!