Hi! I would like to be able to acces items from apps that only appear in the menu bar. For example I'm using the window management app "Magnet", and I would like to acces these menu alternatives in a way you can do with regular apps from the "click menu item"-macro. Is this possible?
- Christian Scheuer @chrscheuer2020-12-08 18:48:03.950Z
I think you should be able to do that, yes.
You may have to use an "Activate App" action to activate the app before clicking its menu items though.
- In reply torobertsorling⬆:Raphael Sepulveda @raphaelsepulveda2020-12-08 21:32:00.038Z
Hey!
I also use Magnet. The script below lets you choose one of the menu items. Just change the
menuPath
to whatever option you want from the menu (in this example, I went with the 'About' option).sf.ui.app('com.crowdcafe.windowmagnet').getElement('AXExtrasMenuBar').popupMenuSelect({ menuPath: ['About'] });
Let me know if that works for ya!
- RIn reply torobertsorling⬆:Robert Sörling @robertsorling
That works! Awesome, thank you!
Christopher Barnett @Christopher_Barnett
Heh Raphael, how did interrogate the menu item to figure out what element you needed to call, did you use some sort of UI inspector ?
thank you
Raphael Sepulveda @raphaelsepulveda2021-04-07 22:14:14.484Z
Yeah! I just used the SoundFlow element picker!
- In reply torobertsorling⬆:Christopher Barnett @Christopher_Barnett
oh duh !
thank you
- AIn reply torobertsorling⬆:Andrew Sherman @Andrew_Sherman
Just adding this for anyone that finds it useful.
If you replace the app ID and menu items in the script below, you should be able to click menu bar items for various different apps. Menu items are case-sensitive and include punctuation occasionally. Also pay attention to the apostrophes in your code.
var app = sf.ui.app('INSERT_APP_ID_HERE'); // com.something.else var appMenu = app.getElement("AXExtrasMenuBar"); appMenu.popupMenuSelect({ isOption: true, menuPath: ['Menu 1', 'Sub Menu 1', 'Sub Menu 1 Option 1...'] });