0

我有这个脚本

tell application "System Preferences"
    activate
    set the current pane to pane id "com.apple.preference.sound"
    reveal anchor "Output" of pane id "com.apple.preference.sound"
end tell

问题是它首先进入了一般配置,所有这些图标,然后才专注于声音。这会产生快速而烦人的闪烁。我只对声音窗格感兴趣。

有没有办法我可以编写一个脚本来只显示声音窗格而不会闪烁?

谢谢!

4

1 回答 1

1

你可以直接使用reveal命令:

tell application "System Preferences"
    activate
    reveal anchor "output" of pane id "com.apple.preference.sound"
end tell

如果您使用的是 UI 脚本,也可以省略 activate 命令:

tell application "System Preferences"
    reveal anchor "output" of pane id "com.apple.preference.sound"
end tell
tell application "System Events" to tell process "System Preferences"
    tell table 1 of scroll area 1 of tab group 1 of window 1
        if selected of row 1 then
            set selected of row 2 to true
        else
            set selected of row 1 to true
        end if
    end tell
end tell
于 2013-06-27T07:49:55.933 回答