No internet connection
  1. Home
  2. How to

Acces items in the Menu Bar

By Robert Sörling @robertsorling
    2020-12-08 18:24:14.972Z

    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?

    Solved in post #3, click to view
    • 7 replies
    1. 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.

      1. In reply torobertsorling:

        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!

        ReplySolution
        1. R
          In reply torobertsorling:
          Robert Sörling @robertsorling
            2020-12-08 22:57:08.946Z

            That works! Awesome, thank you!

            1. 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

              1. Yeah! I just used the SoundFlow element picker!

            2. In reply torobertsorling:

              oh duh !

              thank you

              1. A
                In reply torobertsorling:
                Andrew Sherman @Andrew_Sherman
                  2023-05-13 20:07:29.686Z

                  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...']
                  });