【问题标题】:How to click a checkbox of a drop-down tab in System Preferences如何单击系统偏好设置中下拉选项卡的复选框
【发布时间】:2014-04-21 11:40:52
【问题描述】:

我正在尝试制作 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,我应该提一下。任何帮助将不胜感激。

【问题讨论】:

    标签: 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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-09-15
      • 2021-10-15
      • 2021-05-28
      • 1970-01-01
      • 2016-10-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多