If I have a running application that has an icon in the menubar, but it isn't the currently active app, I want to be able to do the equivalent of clicking the app's icon to get its menu and then select something on that menu. I know that the last part could be done with the "trigger menubar menu item" action, but how to get at the app's menubar icon menu? (running BTT 3.402 on Mojave)
II don't know if BTT has a function for this on board. Otherwise you can try it with AppleScript (UI Scripting).
Here is an AppleScript which you can easily customize:
set theApplication to "Your application name" set theMenuItem to "The menu item name" set theMenuBar to 2 -- depending on application 1 or 2 set theDelay to 0.3 -- try values between .1 and 2 tell application "System Events" tell application process theApplication tell menu bar theMenuBar tell menu bar item 1 ignoring application responses perform action "AXPress" end ignoring end tell end tell end tell end tell delay theDelay -- resolve a bug in UI-Scripting for menu bar do shell script "killall System\\ Events" tell application "System Events" tell application process theApplication tell menu bar theMenuBar tell menu bar item 1 tell menu 1 tell menu item theMenuItem perform action "AXPress" end tell end tell end tell end tell end tell end tell
Thanks Dirk... I worked out a simple AppleScript to do it. Seems like this is a needed and obvious extension to the "trigger menubar menu item" action to be able to specify a menu bar icon for it to apply to.