How do I open the “Share Menu” preferences on OSX?


How do I open the “Share Menu” preferences on OSX?



Much like Safari, trying to implement a button that when clicked opens the preferences on the extensions -> share menu page as shown @ https://i.imgur.com/ZWCCQyJ.png



I have


NSURL *URL = [NSURL URLWithString:@"x-apple.systempreferences:com.apple.preferences.extensions?Share_Menu"];
[[NSWorkspace sharedWorkspace] openURL:URL];



However it seems like that is not working on newer versions, any ideas?




1 Answer
1



You can use Scripting Bridge to do something like this:


SBSystemPreferencesApplication *systemPrefs =
[SBApplication applicationWithBundleIdentifier:@"com.apple.systempreferences"];

[systemPrefs activate];

SBElementArray *panes = [systemPrefs panes];
SBSystemPreferencesPane *notificationsPane = nil;

for (SBSystemPreferencesPane *pane in panes) {
if ([[pane id] isEqualToString:@"com.apple.preferences.extensions"]) {
notificationsPane = pane;
break;
}

}

[systemPrefs setCurrentPane:notificationsPane];

SBElementArray *anchors = [notificationsPane anchors];

for (SBSystemPreferencesAnchor *anchor in anchors) {
if ([anchor.name isEqualToString:@"Extensions"]) {
[anchor reveal];
}
}



Of course you need to add the ScriptingBridge framework to your project and a Scripting Bridge header file for system preferences. More details on how to use Scripting Bridge you can find in the developer documentation from Apple.



Hope this helps






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

List of Kim Possible characters

Audio Livestreaming with Python & Flask

NSwag: Generate C# Client from multiple Versions of an API