The runningappinfo( function returns information about applications that are currently running on this computer.


This function has one parameter:

application – application of interest. This can be either the bundle identifier of the application (text), or the process ID of the application (numeric). If this parameter is omitted, information about all running applications will be returned.


This function returns information about applications that are currently running on this computer. The information is returned in JSON format.

To use this function you will usually need to know the Bundle Identifier of the application you are interested in. The bundle identifier is the unique ID for an app, this ID is assigned by the author of the app and doesn’t change even if the name of the app is renamed or localized. For example, the bundle id of Preview is whether you are in the United States, Italy, or Japan.

Unfortunately, Apple doesn’t make it easy to find out what the bundle ID of an application is. If you know how to do it, you can dig into the app’s plist with a text editor to find it, but probably the easiest method is to use, then type this script in:

osascript -e 'id of app "Preview"' will reply with the id of the app, in this case Substitute the app you are interested in instead of the name Preview when you type the script into the terminal.

Once you know the bundle id, you can use the runninaappinfo( function to find out if that app is currently running. If it is, the function will return information about the app, if not, it will return empty text. For example, this code will test to see if Preview is currently running on your computer.

if runningappinfo("")<>""
    ... do something now that we know that Preview is running

In the example above, we’re not really interested in the detailed information about the app, just whether it is running or not. But the runninaappinfo( function returns much more information about that. On my system right now, the code


returns something like this (it’s actually all on one line, but split into multiple lines below so that it will fit in this help window):


As you can see, 8 items about Preview are returned:

The returned information is in JSON format, which you can convert to a Panorama dictionary with the jsonimport( function. From the dictionary you can easily extract any item you want. This example will open the Finder window that contains the running copy of Preview on your system, even if it has been moved to a non-standard folder.

let previewPath = getdictionaryvalue(jsonimport(runningappinfo("")),"path")
revealinfinder previewPath

Identifying an App by Process ID

If you happen to know the process id of the application you are interested in, you can use that instead of the bundle identifier.


Finding Out About All Running Applications

To find out about all running applications, simply omit the parameter, for example:


This will return one line for every running app. You’ll probably be shocked at how many apps are running on your system, many of which you have never heard of. I’ve massively redacted the list below, there were 212 apps running on my system at the moment when this documentation was being written.

{"identifier":"", "name":"Terminal", "path":"/Applications/Utilities/", "executable":"/Applications/Utilities/", "processid":14542, "active":false, "hidden":false, "menubar":false}
{"identifier":"", "name":"Messages", "path":"/Applications/", "executable":"/Applications/", "processid":14683, "active":false, "hidden":false, "menubar":false}
{"identifier":"", "name":"Safari Web Content", "path":"/System/Library/StagedFrameworks/Safari/WebKit.framework/Versions/A/XPCServices/", "executable":"/System/Library/StagedFrameworks/Safari/WebKit.framework/Versions/A/XPCServices/", "processid":34540, "active":false, "hidden":false, "menubar":false}
{"identifier":"", "name":"Google Chrome", "path":"/Applications/3rd Party Apps/Google", "executable":"/Applications/3rd Party Apps/Google Chrome", "processid":34565, "active":false, "hidden":false, "menubar":false}
{"identifier":"", "name":"Preview", "path":"/Applications/", "executable":"/Applications/", "processid":97652, "active":false, "hidden":false, "menubar":false}
{"identifier":"com.provue.PanoramaX", "name":"PanoramaX", "path":"/Users/jimrea/Library/Developer/Xcode/DerivedData/PanoramaX-ehjikolcvqyxxxhfuplltldupnfg/Build/Products/Debug/", "executable":"/Users/jimrea/Library/Developer/Xcode/DerivedData/PanoramaX-ehjikolcvqyxxxhfuplltldupnfg/Build/Products/Debug/", "processid":34789, "active":true, "hidden":false, "menubar":true}

Each line contains a JSON record, but the overall result is not a JSON array, instead it is a Panorama text array of JSON records. It’s much easier for Panorama code to handle a text array than a JSON array. However, if you need to convert this into a full JSON array, it can be done with this formula:

"[ "+arrayfilter(runningappinfo(),cr(),{import()+","})+" ]"

See Also


10.2NewNew in this version.