macosurl-schemesystem-preferences

Opening certain OS X preference panes programmatically in El Capitan


In Yosemite it is possible to open System Preferences on a specific pane and tab by opening a URL like x-apple.systempreferences:com.apple.preferences.internetaccounts or x-apple.systempreferences:com.apple.preferences.extensions?Share_Menu.

However this no longer works in El Capitan, instead opening just the normal System Preferences. Is there any way to achieve this functionality in El Capitan?

Note: Oddly enough the URL x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility does still work in El Capitan.


Solution

  • One way I've come up with is to execute AppleScript to select the desired pane, however this is not able to select a control within that pane, e.g. the "Share Menu" section of the "Extensions" preferences pane.

    NSString *script = @"tell application \"System Preferences\"\n\tset the current pane to pane \"com.apple.preferences.extensions\"\n\tactivate\nend tell";
    NSAppleScript *appleScript = [[NSAppleScript alloc] initWithSource:script];
    [appleScript executeAndReturnError:nil];