我正在尝试使用 Applescript 断开我的无线键盘。
我想出了这个带有 UI 浏览器的脚本:
activate application "SystemUIServer"
tell application "System Events"
tell application process "SystemUIServer"
click menu item "Disconnect" of menu 1 of menu item "Apple Wireless Keyboard of menu 1 of menu bar item 2 of menu bar 1
end tell
end tell
但是,我收到以下错误:
"System Events got an error: Can’t get menu 1 of menu bar item 2 of menu bar 1 of application process "SystemUIServer". Invalid index."
我在这里做错了什么,我该如何解决?