views:

81

answers:

2

Hi All

I need to open the network-prefpane in my App. This works fine with

[[NSWorkspace sharedWorkspace] openFile:@"/Path/To/PrefPane"];

But how can i directly open the "proxy-settings", which is in the "network-pref" under "advanced"?

You can see this in the Safari-Settings under "Advanced->Proxies"

Thanks

+2  A: 

While it's doable with UI scripting, it also requires access to assistive devices (System Preferences->Universal Access). That doesn't feel right because if a user prefers the access disabled, that just won't work. If you need to modify proxy settings you could use SystemConfiguration.framework directly, going through the necessary authentication.

Costique
I don't want to modify it. Just open it that the user can modify it himself.Thanks for the info with the option in "universal access"
Nobik
+3  A: 

The easiest and cleanest way I've found is to use Applescript.

NSAppleScript *a = [[NSAppleScript alloc] initWithSource:@"tell application \"System Preferences\"\nactivate\nset current pane to pane \"com.apple.preference.universalaccess\"\nend tell"];
[a executeAndReturnError:nil];
[a release];

Replace com.apple.preference.universalaccess with the name of the pane. Here is a full list of preference pane names.

This could be usable for me. Thanks!
Nobik