2014-10-21 65 views
3

我想在不使用鼠标的情况下触发菜单栏应用程序。 CopyClip是确切应用程序的名称。我在网上找到的所有内容都是Ctrl-F2或Ctrl-F8,这些都不允许在菜单栏中访问下载的应用程序。我曾试图这样做了几个星期。 BetterTouchTool不允许这种类型的操作。我猜想我需要写一个这样做的小applescript,但不知道任何帮助或指导如何赞赏。使用键盘在Mac上触发特定菜单栏图标

由于图片在这里说话是我想要的。 This is what happens when I click the menubar icon

+0

菜单栏是SystemUIServer核心服务的一部分,我没有在其中看到任何AppleScript字典。如果你喜欢冒险,你可以通过在自己的代码中注入''[NSMenuToolbar _setCurrentMenuItem:]'方法来玩,但它不适合心脏不好。 – 2014-10-21 23:17:06

回答

2

你必须修改它以适合你的特定应用程序。

运行这些独特的脚本编辑器,检查结果:

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 

这里是你如何在机场,向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是你的朋友。

相关问题