App and window specific macro groups

I'm using Keyboard Maestro 9.0.4 on a Mac with OS 10.14.6. My macros up to now have been very simple. The manual says, 'you can have macros which are active only in Mail.app, or only in Mail.app when a compose window is open.' The latter is exactly what I am trying to do. I've spent two hours so far in reading, watching videos, and experimenting, and I haven't gotten my macro to work yet in a specific window.

I can get it to work for All Windows in the app. I haven't found any information about what the 'compose' window, referred to in the manual, should be called in a macro. 'Compose' didn't work. 'Reply' didn't work. I also haven't found any information about how to identify the name of an app window, with a name that I can include in the 'Available when a focused window title is' field in a Keyboard Maestro macro, as the general type of window (such as 'compose'). I can get Keyboard Maestro to identify a window in Mail, but the name it returns is specific to a message, such as 'RE: Tuesday's meeting'. I want to be able to run the macro in any and every Reply window or Compose window, regardless of the Subject field text, but not in other Mail windows.

Finally, while the feature is called 'Macro Groups', it seems like many/most app and window specific groups will only contain one or two macros, and I might end up with six different Macro Groups for Mail, each to do one thing in a different type of window. Is there a way to have a Mail Macro Group, and within it, define the window criterion separately for each individual macro?

The way to do this is probably documented and explained somewhere. If so, please share a link with me.

Give this a try:

image

When any of the folders have focus, the window title is something like this:
image

But a Compose Window is:

  • Starts out as "New Message"
  • When you enter a Subject, the Window title is the Subject

So we need to look for a Window Title that does NOT contain

  • Open parenthesis (
  • One or more digits
  • space
  • the text "messages"

This Regex does that:
\(\d+ messages

1 Like

Thank you very much. I never would have figured that out on my own. I appreciate your taking the time to help me make a successful macro.

1 Like

A post was split to a new topic: Is there any way for KM to know that Alfred is now the focused window?