我想在不使用鼠标的情况下触发菜单栏应用程序。 CopyClip 是确切应用程序的名称。我在网上找到的所有内容都是 Ctrl-F2 或 Ctrl-F8,这些都不允许访问您在菜单栏中下载的应用程序。我已经试了好几个星期了。 BetterTouchTool 不允许此类操作。我猜我需要写一个小的 applescript 来做到这一点,但不知道如何提供任何帮助或指导。
既然图片说话,这就是我想要的。
最佳答案
您必须修改它以适合您的特定应用。
在脚本编辑器中分别运行它们并检查结果:
tell application "System Events" to menu bar items of every menu bar of ¬
process "SystemUIServer"
.
tell application "System Events" to value of attributes of menu bar items of menu bar 1 of ¬
process "SystemUIServer"
.
tell application "System Events" to value of attributes of menu bar 1 of ¬
process "BetterTouchTool"
以下是您如何从 BetterTouchTool 单击首选项:
tell application "System Events" to tell process "BetterTouchTool"
click first menu bar item of menu bar 1
click menu item 1 of menu 1 of menu bar item of menu bar 1
end tell
以下是在 AirPort 中关闭 WiFi 的方法:
tell application "System Events" to tell process "SystemUIServer"
click (first menu bar item whose value of attribute "AXDescription" contains "Wi-Fi") ¬
of menu bar 1
try
click menu item 2 of menu of ¬
(first menu bar item whose value of attribute "AXDescription" contains "Wi-Fi") of ¬
menu bar 1
end try
end tell
Accessibility Inspector
是您的 friend 。
关于macos - 在 Mac 上使用键盘触发特定的菜单栏图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26497349/