I'd like the following behavior:

When I press [Cmd+S]:
   IF <Chrome is at the front>:
       Simulate the keystroke [Control] + [Tab]
   ELSE IF < Spotify is at the front>:
       Simulate the keystroke [Cmd] + [Right Arrow]
       # Send the original keystroke
       Simulate the keystroke [Cmd] + [S] 

How do I do this in Keyboard Maestro?

I thought selecting a Control Flow => Switch/Case macro would help me do this, but when I try to drag it to use it in an action clause it says "Switch of System Clipboard", and I can't find a way of converting this Switch/Case block into a switch statement based on the application at the front.


I'd suggest posting this on the Keyboard Maestro Forum in the future – they're very responsive there:

There are a few ways I can think of. First, you could set a variable based on the front application and then use that in the switch/case. This involves "set variable to text" %Application%1%(front application name) and then using switch case based on the variable (see below).

Basically, you're getting the front application name and then using switch case based on whatever the front application is named.

Set variable to text: enter image description here

Switch case: enter image description here

Second, you could just nest the 'if' statements (below). Thus, you ask the first 'if' statement and then if that isn't true, you go to the 'else' statement, which contains the second 'if' condition.

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .