PDA

View Full Version : Opening Growl preferences pane from Cocoa application




MacDonaldsd
Feb 2, 2008, 03:21 PM
Hi,

Is their anyway to open up system preferences, and select a specific application within the growl preference pain, from inside a cocoa application (e.g. pressing a button) ?



HiRez
Feb 2, 2008, 03:34 PM
Is their anyway to open up system preferences, and select a specific application within the growl preference pain, from inside a cocoa application (e.g. pressing a button) ?I think AppleScript is your best bet. You can call an AppleScript from Cocoa. See the documentation for NSAppleScript and check out this page (http://www.apple.com/applescript/features/system-prefs.html) for scripting System Preferences.

kainjow
Feb 2, 2008, 04:44 PM
Here you go:

tell application "System Preferences"
activate
set the current pane to pane id "com.growl.prefpanel"
end tell

MacDonaldsd
Feb 3, 2008, 05:53 AM
Here you go:

tell application "System Preferences"
activate
set the current pane to pane id "com.growl.prefpanel"
end tell

Thanks again kainjow

I don't see why the following doesn't work though:

tell application "System Preferences"
activate
set the current pane to pane id "com.growl.prefpanel"
get the name of every anchor of pane id "com.growl.prefpanel"
reveal anchor "Applications" of pane id "com.growl.prefpanel"
end tell

valexa
Jul 5, 2009, 11:43 AM
Thanks again kainjow

I don't see why the following doesn't work though:

tell application "System Preferences"
activate
set the current pane to pane id "com.growl.prefpanel"
get the name of every anchor of pane id "com.growl.prefpanel"
reveal anchor "Applications" of pane id "com.growl.prefpanel"
end tell

that is because names are not assigned to the tabs in the growl panel by the developer , if you look at Result in script editor after running
get the name of every anchor of pane id "com.growl.prefpanel"
it shows a empty list {} , in com.apple.preferences.users for example you get {"passwordPref", "startupItemsPref", "mobilityPref", "loginOptionsPref", "picturePref"}