自动器错误(系统事件出现错误:无法获取复选框)

时间:2018-10-01 05:59:05

标签: applescript automator macos-mojave

我有一个自动应用程序,可以在单声道和立体声之间切换音频。它曾经可以工作,但是Mojave更新似乎打破了它。我已授予它可访问性权限,但仍然没有运气。可能是什么问题?

tell application "System Preferences"
    launch
    reveal anchor "Hearing" of pane id "com.apple.preference.universalaccess"
    tell application "System Events" to tell process "System Preferences"
        delay 0.5
        click the checkbox "Play stereo audio as mono" of window "Accessibility"
    end tell
end tell
tell application "System Preferences" to quit

错误消息如下:

  

“运行AppleScript”操作遇到错误:“获得了系统事件   错误:无法获得窗口的“以单声道播放立体声音频”复选框   进程“系统偏好设置”的“可访问性”。

提前谢谢!

1 个答案:

答案 0 :(得分:1)

尝试一下...

tell application "System Preferences"
    reveal anchor "Hearing" of pane id "com.apple.preference.universalaccess"
end tell
tell application "System Events"
    repeat until exists of checkbox "Play stereo audio as mono" of group 1 of window "Accessibility" of application process "System Preferences"
        delay 0.1
    end repeat
    click checkbox "Play stereo audio as mono" of group 1 of window "Accessibility" of application process "System Preferences"
end tell
tell application "System Preferences" to quit