Reputation: 1
Which API can I use to open the Network Preferences interface?
Upvotes: 0
Views: 693
Reputation: 1479
You have several options (you didn't specify where you need to run the code). System Preferences has its own URI for opening specific panes but this seems to be working sporadically on OS 10.11 El Capitan:
open "x-apple.systempreferences:com.apple.preference.network"
You could also open the preference pane directly (System Preferences handles .prefPane bundles):
open "/System/Library/PreferencePanes/Network.prefPane"
System Preferences can also be scripted:
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.network"
end tell
or from the command line:
osascript -e 'tell application "System Preferences"' -e 'activate' -e 'set current pane to pane "com.apple.preference.network"' -e 'end'
Upvotes: 3