如何单击“系统偏好设置”中下拉选项卡的复选框

时间:2014-04-21 11:40:53

标签: applescript

我正在尝试使用AppleScript更改“系统偏好设置”中的选项。通过单击“辅助功能”窗格的“鼠标和触控板”菜单中的“鼠标选项...”,可以显示该复选框。到目前为止我编写的脚本能够浏览“系统偏好设置”,以便可以单击所需的复选框。但是,我无法找到一种方法来单击该复选框,因为该复选框位于窗口上的某种“下拉选项卡”中。我在网上找到的这些教程都没有涉及这个具体问题。

到目前为止我的代码 -

tell application "System Preferences"
 activate
 set the current pane to pane id "com.apple.preference.universalaccess"
 get the name of every anchor of pane id "com.apple.preference.universalaccess"
 reveal anchor "Mouse" of pane id "com.apple.preference.universalaccess"
 tell application "System Events" to tell process "System Preferences"
    click button 5 of window "Accessibility"
 end tell
end tell

所需的复选框是“滚动”。我希望以下代码可以正常工作,但它不会在后台单击复选框,而不是选项卡中的复选框。

tell application "System Events" to tell process "System Preferences"
    click checkbox 1 of window "Accessibility"
 end tell

这是我第一次使用AppleScript,我应该提一下。任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:1)

'下拉标签'被称为表格:

tell application "System Preferences"
 activate
 set the current pane to pane id "com.apple.preference.universalaccess"
 reveal anchor "Mouse" of pane id "com.apple.preference.universalaccess"
  tell application "System Events" to tell process "System Preferences"
   click button 5 of window 1
   click checkbox 1 of sheet 1 of window 1
  end tell
end tell