Deactivate and activate macro group in the same macro

I've a macro that deactivate a macro group so I type in Alfred without interfering in my Mail macro shortcuts. The deactivation works fine but I would like to activate it again when I finish typing/using in Alfred with enter or escape.



This is actual macro I've:

Any ideas?

The first thing that jumps out at me is you have the AppleScript appending it's value to a variable...which probably doesn’t matter since it's a local variable, but try switching that to save to variable and try it again.

Also, values returned from AppleScripts sometimes appear to be "true" or "false" or whatever your naming convention is you use in the AppleScript itself, but I have seen enough examples of where there's an extra space or something in there that the Keyboard Maestro If action does not like the ìs condtiion; try switching that to contains and try that too.

One other thing to try is changing the key down to key pressed as sometimes if the key is down and up again very quickly (like usually happens when typing) Keyboard Maestro might not catch that.

EDIT: Also... it's pretty early morning in the US where a fair amount of the forum resides so be patient and i'm sure more will chime in soon once everybody gets up and moving. :wink:

thanks cdthomer. I will try or advises!

Thanks noisneil. I've seen this macro already but since I'm not a developer I didn't find a way to merge the two. I believe it could work but I've lost some time trying it without success.

Just select your group in the red and green actions.

Alfred - Disable Certain Groups-Macros.kmmacros (57 KB)

Macro screenshot

I've done it. What happens is that Alfred doesn't work well. appear an disappear immediately

You're right. Funny, because this was working fine for me when I last checked. Seems KM no longer 'eats' the Alfred hotkey, so it's double-triggering.

Out of curiosity, is there any reason you can't just use this?

Alfred - Disable Certain Groups-Macros.kmmacros (49 KB)

Macro screenshot

Ok my bad. I forgot how the macro is supposed to be set up. The above simplistic version may be enough for your needs, but if you want to use the full macro that accounts for double triggering, this is what you need to do:

  1. Use the below macro instead of the previous version you downloaded.
  2. Change your Alfred shortcut to ⌃⇧Space. Don't change the hotkeys in the macro.
  3. Select your group in the red and green actions.

Alfred - Disable Certain Groups-Macros.kmmacros (57 KB)

Macro screenshot

Wow. Fantastic noisneil! Thank you. Tried a couple of times and it worked just fine.

I've also searched in Alfred forum and if do the following Alfred will behave as frontmost app when active:
"Launch Alfred's prefs to Appearance > Options (in the bottom left) and choose Focusing: Compatibility mode which makes Alfred behave like an app taking focus."

Maybe this can be a help for someone.




I have a similar problem with Mail's search feature. Since I use one key shortcuts in Mail it causes conflict when I use "search".

I've made a macro to disable temporarily a macro group and at the end enable it again with a key condition but it doesn't enable the macro as expected.

Can anyone help me on this?


You've got a bit confused there. Happens to us all!

Your macro repeatedly disables the group until a key is down and then stops. What it doesn't do is re-enable it.

Try this instead:

Mail Search.kmmacros (39 KB)

Macro screenshot

I don't have an Enter key, so you have to add that and then select your Mail group in the coloured actions.

1 Like

Super! Thank you noisneil!

yes, my logic wasn't correct... :slight_smile:


1 Like

Try Function-Return while in the "Enter key" box.

1 Like

I think I knew that years ago and forgot. Thanks!