2014-02-08 22 views
1

我特林选择“Soundflower(双声道)”作为使用该脚本我的音频输出:语法错误在AppleScript的为小牛

tell application "System Preferences" 
    activate 
    set the current pane to pane id "com.apple.preference.sound" 
    get the name of every anchor of pane id "com.apple.preference.sound" 
    reveal anchor "output" of current pane 
    select (row 1 of table 1 of scroll area 1 of tab group 2 current pane) 
end tell 

它给人的错误:

语法错误:预期“” 但发现号

为 “第1行”

什么是正确的格式?

我也试过:

tell application "System Preferences" 
    activate 
    set the current pane to pane id "com.apple.preference.sound" 
    get the name of every anchor of pane id "com.apple.preference.sound" 
    reveal anchor "output" of current pane 
    select (row, 1 of table, 1 of "scroll area", 1 of "tab group", 2 of current pane) 
end tell 

,但得到

语法错误:无法获得表1。不允许访问。

我该怎么做?

回答

1

Try:

tell application "System Preferences" 
    activate 
    set myPane to pane id "com.apple.preference.sound" 
    set the current pane to myPane 

    tell myPane 
     name of every anchor -- {"output", "input", "effects"} 
     reveal anchor "output" 
    end tell 
end tell 

-- Use this script as a wrapper for GUI Scripting statements when you are confident that GUI Scripting is available and enabled or that the user knows how to enable it if necessary 

activate application "System Preferences" 
tell application "System Events" 
    tell process "System Preferences" 
     select row 1 of table 1 of scroll area 1 of tab group 1 of window 1 
    end tell 
end tell