Adding simple If - else logic and error trapping to macros

Hi,

I am curious how to use If - else logic and error trapping with keyboard maestro macros?

Like this simplistic example...

If (

Safari app is active

){
Speak text "Safari is active"
}else{
Speak text "Safari is not active"
}

Is there some way to do this with KM

Like this?

There are other options in the dropdown under the application condition, like: is/is not running, is/not hidden.

You might also want to look at Switch/Case action

4 Likes

@evanfuchs has nicely covered conditional branching via If/Else and others, but if you do also want actual error trapping you should look at the Try/Catch action.

3 Likes

yes that is great - thanks very much evanfuchs!

Ok great I will also take a look at this - many thanks for the suggestion.