如何单击系统偏好设置中下拉选项卡的复选框 [英] How to click a checkbox of a drop-down tab in System Preferences

查看:16
本文介绍了如何单击系统偏好设置中下拉选项卡的复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆