gpt4 book ai didi

objective-c - 以编程方式打开带有部分的 PrefPane

转载 作者:太空狗 更新时间:2023-10-30 03:49:50 24 4
gpt4 key购买 nike

我需要在我的应用程序中打开 network-prefpane。这适用于

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

但是如何直接打开“高级”下“网络首选项”中的“代理设置”?

您可以在“高级->代理”下的 Safari 设置中看到这一点

谢谢

最佳答案

我发现的最简单、最干净的方法是使用 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];

将 com.apple.preference.universalaccess 替换为 Pane 的名称。 Here is a full list of preference pane names .

关于objective-c - 以编程方式打开带有部分的 PrefPane,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2042066/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com