Try/Catch Not Working for Bring Window to Front Action?

Hi Folks!

I've been trying to refine my work macros a bit more to include edge cases and catch potential issues instead of having to clean up the mess when these issues happen.

Part of my workflow includes bringing a specific named Safari window to the front, and I wanted to have a try/catch notify me and abort the macro if that action happens to fail.

However, I seem to be completely unable to prompt a failure from the "try" action even when no window with that name exists.

When I've tried debugging this macro and stepping through the process, it just leaves me with whatever Safari window was brought to the front when the application was initially activated but seemingly counts it as a success?

I get no notification or cancellation. The main point is so I can do my work in this preferred browser while having other things open at the same time – my workaround thus far has been to have the work tab be the only open Safari tab and switch to Firefox for my other things, but I'd really like to keep everything within the one browser.

Does the Bring Window action not have a failure return mechanism?

Thanks again for the help and my apologies if this is a noob question – the last question I had answered on here certainly was but folks were extremely helpful and speedy.


I'm seeing the same problem, and it does seem... weird.

While we wait for the gurus, work round the problem by trying to bring the window to the front then testing the %ActionResult% token (effectively your own Try/Catch):

Safari Window to Front with Error.kmmacros (5.0 KB)


Would a short pause of say .3 seconds placed after the Safari activation help?

Hey Guys,

It works for me, so long as I remember to turn on “Failure Aborts Macro” in the “Bring Window to Front” action's contextual (or gear) menu.


Safari ⇢ Try - Catch Test ⇢ Reddit v1.00.kmmacros (9.6 KB)
Keyboard Maestro Export