如何以编程方式打开 Safari-> 首选项窗格

San*_*war 3 qt objective-c

我正在开发 safari 插件。我在其中添加了一些 Qt 代码。现在,当用户单击 Qt 对话框上的 QPushButton 时,我想打开“safari->首选项”窗格。如果 Objective-C 也可以,请告诉我。

San*_*war 5

最后我得到了它。这是我的解决方案:

tell application "Safari" to activate

delay 4

tell application "System Events" to tell process "Safari"

    keystroke "," using command down

    tell window 1
        click button "Extensions" of tool bar 1
        activate "Extensions"
        keystroke return
    end tell
end tell
Run Code Online (Sandbox Code Playgroud)

使用此AppleScript,我们可以以编程方式打开Safari->首选项。