使用 Applescript 更改没有标题的复选框的值
我尝试制作一个Applescript来启用“系统偏好设置”中“网络”设置的“高级..”菜单中的“Web代理”和“安全Web代理”选项。
到目前为止,这是我的 applescript..
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.network"
end tell
tell application "System Events"
tell application process "System Preferences"
tell window "Network"
click button "Advanced…"
tell tab group 1 of sheet 1
click radio button "Proxies"
tell group 1
//what to do here to change Web Proxy and Secure Web Proxy Checkboxes?
end tell
end tell
end tell
end tell
end tell
我无法更改“Web 代理”和“安全 Web 代理”设置的值,因为它们没有辅助功能检查器显示的标题。
有没有其他方法可以使用类似于我上面尝试过的 Applescript 来启用/禁用复选框?
I tried to make an Applescript to enable the "Web Proxy" and "Secure Web Proxy" option in the "advanced.." menu of the "Network" settings in System Preferences.
Here's my applescript so far..
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.network"
end tell
tell application "System Events"
tell application process "System Preferences"
tell window "Network"
click button "Advanced…"
tell tab group 1 of sheet 1
click radio button "Proxies"
tell group 1
//what to do here to change Web Proxy and Secure Web Proxy Checkboxes?
end tell
end tell
end tell
end tell
end tell
I cannot change the value of the "Web Proxy" and "Secure Web Proxy" settings because, they have no title as shown by Accessibility Inspector.
Is there any other way to enable/disable the checkboxes using an Applescript similar to the one I have tried above?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
/usr/sbin/networksetup 中有一个名为“networksetup”的命令行工具。我没有太多使用它,但是查看它的手册页,有一些关于代理的内容。这是我看到的几个...
所以使用这些命令的“do shell script”命令应该可以完成这项工作。不幸的是,我无法帮助您使用特定命令,但祝您好运。
顺便说一下,在手册页的示例中它显示了这些......
There is a command line tool called "networksetup" at /usr/sbin/networksetup. I haven't used it much but looking at the man page for it there are several things regarding proxies. Here's a couple I see...
So a "do shell script" command using these should do the job. Unfortunately I can't help you with the specific commands but good luck.
By the way, down in the examples on the man page it shows these...