Is there any way to test if an app is running by its CFBundleName?


I am in a pickle trying to automate a process because the company that makes it uses the same executable names and app ID’s for several apps, and only varies them by the CFBundleName (that shows up in the force-quit dialog. Is there a Finder, System Events or Terminal command to search the same list that Force Quit sees?


PS Just realized I can also use the CFBundleIdentifier as well. Is there a way to check that with Finder, System Events or PS in Terminal?

The CFBundleIdentifier is the app’s ID.

I’m running this piece of code since more than a month :

tell application "System Events"
	set theProcessesProperties to properties of every process whose name is "Pages"
	set {thePosixPaths, theArchitectures, theIDs, theUnixIDs} to {{}, {}, {}, {}}
	repeat with processProperties in theProcessesProperties
		set end of thePosixPaths to POSIX path of file of processProperties
		set end of theArchitectures to architecture of processProperties
		set end of theIDs to bundle identifier of processProperties
		set end of theUnixIDs to unix id of processProperties
	end repeat
end tell
{thePosixPaths, theArchitectures, theIDs, theUnixIDs}
--> {{"/Applications/iPlay '13/", "/Applications/iWork '09/Pages"}, {"x86_64", "i386"}, {"", ""}, {2345, 2363}}

You are lucky if the company use different bundle identifiers.
As you may see above, Apple doesn’t do that for Pages (for Numbers or Keynote too).
So I use the architecture property to identify the running one.

Yvan KOENIG running Sierra 10.12.0 in French (VALLAURIS, France) samedi 22 octobre 2016 16:03:32

Thanks very much for the reply Guys - I found the answer to getting the CFBundleName!!

Simply query System Events for the “displayed name”.