AppleScript – Get the path to an application without opening it

applescriptpath

I need to store the path to Chromium to use later in the script, however running set chromium to (POSIX path of (path to application "Chromium")) in AppleScript Editor opens the application. How can I store the path to the application without causing the application to open. Hard coding the path worked, but I wanted to be able to find the application path instead.

Best Answer

Use Finder to get an application file object:

tell application "Finder"
    POSIX path of (application file id "org.chromium.Chromium" as alias)
end tell

You can also get the bundle identifier with id of app "Chromium".