How can I reliably detect if a specific app (with a short name) is running for automation purposes?

Hi everyone,

I’m working on an automation workflow where I want my system to automatically set the default browser based on which browser is currently active, following a certain priority order. To do this, I’m checking the list of running processes to see if a browser’s process is active, and then changing the default browser accordingly.

The issue I’m running into is that one of my browsers is called “Dia,” which is only three letters. When I check if the running processes contain “Dia,” it ends up matching a lot of unrelated things, since “dia” is a pretty common substring in process names.

Is there a better way to specifically check if a particular application (with a short or generic name) is running, so I can avoid these false positives? Any tips on how to make this more reliable would be greatly appreciated!

Thanks in advance for your help.

As internally it is a comma separated list you can check for ",Dia," or "Dia,"

Oh wow lol I didn't know this. Thanks!

It does make me wonder what if there are two apps running with the same name how are those identified

that’s a scenario which can’t be covered via the running processes variable. For this you’d need to use custom apple or shell script. However I don’t think there are many apps with the same name

Yes thought so, thanks will keep in mind (I sometimes keep multiple versions of the same application installed)