AppleScript: Find Pane ID for System Preferences.app

I just started diving into AppleScript a little more, and figured out a nifty way of finding the pane ID for any of the panes (General, Mouse, Network, etc.) in the System Preferences app. This is extremely useful for creating scripts that need to access any of the System Preferences.app settings.

Tested on Mac OS X 10.11.5.

Copy and paste the following into the Script Editor app, located in Applications>Utilities. Pay attention to the comment in the first line as well, or else the script won’t work:

-- Open System Preferences.app and click into desired pane/setting. Then, run this script to find out name (Pane ID).

tell application "System Preferences"
	set CurrentPane to the id of the current pane
	set the clipboard to CurrentPane
	display dialog "Current Pane ID: " & CurrentPane & return & return & "Pane ID has been copied to the clipboard."
end tell

Click Compile, then Run.

A dialog box will appear with the Pane ID and it will be copied to your clipboard. Click OK.

applescript_pane_ID

3 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *