【问题标题】:Syntax errors in AppleScript for MavericksAppleScript for Mavericks 中的语法错误
【发布时间】:2014-03-06 00:39:32
【问题描述】:

我正在尝试使用此脚本选择“Soundflower (2ch)”作为我的音频输出:

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。不允许访问。

我该怎么做?

【问题讨论】:

    标签: macos audio applescript syntax-error osx-mavericks


    【解决方案1】:

    试试:

    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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-21
      • 2013-09-09
      • 1970-01-01
      • 1970-01-01
      • 2015-04-17
      • 1970-01-01
      相关资源
      最近更新 更多