Check if Safari Is Running and the URL Contains Specific Text

Is this the best way to check if a certain URL contains a word?


My goal is to have a macro that clicks some buttons inside Todoist's web app, so I need Safari to be at the front and I need it to check if the window is showing Todoist.

That should do it. You could get rid of the frontmost app condition and just put the macro in a group that is only available when Safari is at the front. An exception to this would be if you wanted the macro to be triggered by Safari activating/launching, in which case it would need to be in a global group. Another exception would be if you wanted the macro to do something else when Safari is not at the front.

By checking for "todoist", you will get false positives for things like articles/searches related to Todoist. A better idea is to check for "". Probably not an issue if the macro is triggered manually, but if, for example, the trigger is a front window change, then searching for "how do I do xyz in todoist" will trigger the macro.

If you want to do a few of these URL-dependent macros, you could set up a standalone macro that sets a global variable to %SafariURL% on every front window change in Safari, so that the current URL is always available to you.


True. I actually had the group be limited to Safari, so yeah, I just removed that extra condition. Thanks!

Yes, these macros are triggered manually. But I changed it anyway. It won't hurt...

For now this is actually the first time I need this, but if I see myself doing this more often, I will use that trick. Thanks for sharing!

1 Like

For things like this I prefer to skip the variable step and check the token directly with a Text condition:

But there's nothing at all wrong with setting it to a variable first if that's your preference, as the macro will run just as quickly either way.


Oh that's cool. It removes a few actions :wink: Awesome!
Thanks for sharing that alternative. Always learning new tricks!