Opening Growl preferences pane from Cocoa application

Discussion in 'Mac Programming' started by MacDonaldsd, Feb 2, 2008.

  1. macrumors 65816

    MacDonaldsd

    Joined:
    Sep 8, 2005
    Location:
    London , UK
    #1
    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) ?
     
  2. macrumors 601

    HiRez

    Joined:
    Jan 6, 2004
    Location:
    Western US
    #2
    I think AppleScript is your best bet. You can call an AppleScript from Cocoa. See the documentation for NSAppleScript and check out this page for scripting System Preferences.
     
  3. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #3
    Here you go:

    Code:
    tell application "System Preferences"
    	activate
    	set the current pane to pane id "com.growl.prefpanel"
    end tell
     
  4. thread starter macrumors 65816

    MacDonaldsd

    Joined:
    Sep 8, 2005
    Location:
    London , UK
    #4
    Thanks again kainjow

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

    Code:
    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
     
  5. macrumors member

    Joined:
    Nov 3, 2007
    #5
    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
    Code:
    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"}
     

Share This Page