Programmatically open PrefPane with section

cocoa, macos, objective-c

Solution

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.

Problem

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

Original source