提问者:小点点

如何单击“系统首选项”中下拉选项卡的复选框


我正在尝试制作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个答案

匿名用户

“下拉选项卡”称为工作表:

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