Reputation: 627
I want to trigger a MenuBar application without using my mouse. CopyClip is the name of the exact application. All I have found online is Ctrl-F2 or Ctrl-F8 none of these allow access to your downloaded applications in the menubar. Its been weeks Ive tried to do this. BetterTouchTool Does not allow for this type of action. Im guessing Ill need to write a little applescript which does this but don't know how any help or guidance is much appreciated.
Since pictures talk here is what I want.
Upvotes: 4
Views: 1325
Reputation: 383
You have to modify this to fit your specific app.
Run these individually in Script Editor and inspect the results:
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"
Here is how you click Preference from 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
Here is how you turn WiFi Off in AirPort:
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
is your friend.
Upvotes: 4