0
我想AppleScript单击一个菜单栏图标(不是系统进程),然后点击其中一个菜单项。我使用OS X 10.10。AppleScript:菜单栏项点击(但没有AXDescription)
我读过我可以使用辅助功能检查器来查找该项目的AXDescription,但是,我无法在检查器中的任何地方找到它(实际上我检查的项目中没有一个似乎具有此属性) 。
我也试过方法described here,但在第10行得到一个错误:
ignoring application responses
tell application "System Events" to tell process "Webcam Settings"
click menu bar item 1 of menu bar 2
end tell
end ignoring
do shell script "killall System\\ Events"
delay 0.1
tell application "System Events" to tell process "Webcam Settings"
tell menu bar item 1 of menu bar 2
click menu item "Show Webcam Settings Panel" of menu 1
end tell
end tell
System Events got an error: Can’t get menu 1 of menu bar item 1 of menu bar 2 of process "Webcam Settings". Invalid index.
那么你的道路就是错的。显示您的应用程序的屏幕截图,以打开该菜单项。上面的锁定辅助功能检查器是否显示菜单或菜单项。你确定它是菜单栏2吗? – jweaks 2014-11-04 17:04:26
你能解释一下你的路径名是什么意思吗? AI在截图中锁定了菜单栏项(图标)。下面是AI锁定菜单项的屏幕截图http://cl.ly/image/1B053O2P2D3H如何知道菜单栏是1还是2? – Sebastien 2014-11-04 20:59:24
好的,你没有访问标准菜单,而是在菜单栏右侧的实用程序图标菜单。部分问题可能是这是一个“不露脸”的应用程序。它出现在Dock吗?其“最前面”可以设置为“真”吗?否则,系统事件可能无法访问其菜单项。 – jweaks 2014-11-04 21:50:45