如何在“系统偏好设置"中单击下拉选项卡的复选框 [英] How to click a checkbox of a drop-down tab in System Preferences
问题描述
我正在尝试使AppleScript更改系统偏好设置"中的选项.通过在辅助功能"窗格的鼠标和触控板"菜单中单击鼠标选项...",可以显示该复选框.到目前为止,我已编写的脚本能够在系统偏好设置"中导航,以便可以单击所需的复选框.但是,我找不到找到该复选框的方法,这似乎是因为该复选框位于窗口的某种下拉选项卡"中.我在网上没有找到有关此特定问题的教程.
I'm trying to make an AppleScript to change an option in System Preferences. The checkbox is revealed by clicking "Mouse Options..." in the "Mouse and Trackpad" menu of the "Accessibility" pane. The script I have written so far is able to navigate through System Preferences so that the desired checkbox is visible to be clicked. However, I can't find a way to click the checkbox, seemingly because the checkbox is within a sort of 'drop down tab' on the window. None of the tutorials I have found online deal with this specific issue.
到目前为止我的代码-
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
所需的复选框是滚动".我希望下面的代码可以工作,但是不能-单击后台的复选框,而不单击选项卡中的复选框.
The desired checkbox is "Scrolling". I expected that the following code would work, but it does not- it clicks checkboxes in the background, not the one in the tab.
tell application "System Events" to tell process "System Preferences"
click checkbox 1 of window "Accessibility"
end tell
这是我第一次使用AppleScript.任何帮助将不胜感激.
This is my first time using AppleScript, I should mention. Any help would be much appreciated.
推荐答案
下拉选项卡"称为工作表:
The 'drop down tab' is called a sheet:
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
这篇关于如何在“系统偏好设置"中单击下拉选项卡的复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!