How to skip menu when a hotkey is shared by different macros?

I have set up two macros with the same hotkey: ^Q.

Each macro targets a different app, and each macro tests to see if its target app is at the front via the first action,“If all conditions met execute actions / If all of the following are true: / This application / app1 / is at the front, execute the following actions:”, and if so, executes some simple steps, and if not, does nothing (that is, “otherwise execute the following actions” is empty).

However, when I tap ^Q (^q, actually), regardless of the app that is at the front, KM’s menu for ^Q that lists both macros comes up.

I’d prefer that when tapping ^Q in one of the targeted apps, its macro runs and the menu is not activated, and when neither of the targeted apps in at the front, tapping ^Q does not activate any KM macro.

Is there a way to achieve this behavior other than creating one macro that uses nested “If all conditions met execute actions” steps (I assume this would do what I want)?

Thanks.

Create a “group” for each app, set the group to be available in that app, and then put macro you want to run with ^Q in that group. So if the apps are Mail and Safari, create a group for Mail and put the mail-specific macro in it with trigger of ^Q and then create a group for Safari, and put the Safari-specific macro in that group with the same trigger. Now, when in Mail and typing ^Q, only the Mail-specific macro runs; ditto for Safari.

1 Like

See thread Application Specfic Macros for a pictorial explanation

1 Like

@rolian’s solution is the general solution to application-specific macros. Another solution is to have a single macro that does this:

If app 1 is at front
    do app 1 stuff
if app 2 is at front
    do app 2 stuff

You may want to use the Else part of the if, and/or use Cancel This Macro to ensure only one part is done, or to allow you to have a default action. Eg

If app 1 is at front
    do app 1 stuff
    Cancel This Macro
if app 2 is at front
    do app 2 stuff
    Cancel This Macro
do general stuff

Thanks very much for the tips. I have previously used the technique of checking the app that is at front but have now opted for grouping macros into app-specific groups, as this technique lessens clutter and, well, groups the macros, keeping them organized.

Thanks again for your help.

1 Like