If Prior Step Fails, Execute Next Step

I’m trying to get Microsoft Outlook 365 on my Mac to use Command-L to mark a message both as Unread and as Read. Problem is, you can’t use the Keyboard Shortcuts menu as you can for most other apps on the market to accomplish this. So I turned to Keyboard Maestro.

Problem here is: I give KM two macros, one for unread and one for read, and it freaks out. So now I’m trying to have just one macro that executes when I press Command-L and if one string fails, the other will execute (i.e. if the message is “read” and I want it to mark as “unread,” Maestro will first try and fail to execute “Mark as Read,” and will then revert to “Mark as Unread.”) I’ve fiddled with the If/Then Else macro, but I’m failing. Any insight?


p.s. I did review the thread called “On Step Failure Jump to Step” but I found it remarkably confusing.

You can use the KM ActionResult Token to determine if an Action failed. If it is NOT "OK", then it failed.

1 Like


Thanks so much for the quick reply - I tried fiddling with the “ActionResult Token,” but I can’t figure out how to integrate it into the “If/Then Else” in such a way to help me.

Fortunately, I resolved the issue with a weird/unexpected work around.

I created a “Mark as Unread” Macro and have it set to select the menu item “Mark as Read,” with an “If/Then Else” condition that refers to itself: if the “Mark as Unread” macro is inactive, then execute nothing, but if otherwise, execute the following actions: "select menu item “Mark as Unread.”

Not really sure why it works, but it does.

To get better help, please post your macro.

That's a "good news/bad news" story. :wink:
It may work for now, but you don't know if it will have unintended consequences. Best to find a solution that you do understand.

The Select or Show a Menu Item action accepts alternatives directly in the action, ie:

Mark as Unread|Mark as Read

1 Like


This is AWESOME! It very clearly solves the problem. And I definitely would have never thought of that on my own.

JMichael - I agree. I will need to figure this out. But with Peter’s solution, I’ll wait for another fire before investing the time.

You guys are great!