No internet connection
  1. Home
  2. How to

Selecting sub-menu items in Cubase in floating Windows

By Steve @stevef
    2018-07-31 19:22:16.161Z

    Possibly one for @JesperA - I know you can select main menu items using for example

    sf.ui.cubase.menuClick ({menuPath: ['Edit', 'Project Logical Editor...']});

    But that seems to only work for the main menus at the top. So it won't work for the drop down menu for the Logical Editor. So I am struggling to select sub-menu items which I have. For example I want to select a sub-menu items so I can then mouse click on parameters and fill this in with what ever is relevant (using script) rather than just running a preset from the main menu.

    But, because they are in sub-menus, mouselcick doesn't work. I thought perhaps of using 'sf.mouse.setPosition' to basically hover over items what a bit and then set a new position. But that I think is relative to the whole screen, so wouldn't work if I ever move the Logical Editor window. Or is there a relative setposition?

    Or am I missing something, and there is an easier way?

    Thanks.

    Solved in post #7, click to view
    • 9 replies
    1. So the main problem is that Cubase don't share that much info with OSX. A lot of the windows are just blank spaces from what OSX can see, which makes a lot of the things we wanna do a bit more difficult.
      Pro Tools and Logic is different/easier, as every element is represented, but then again, we have a fantastic MIDI editor, logical editor presets, NoteExpression and ExpressionMaps.

      Anyway, when I use a UIElementInspector I can see the drop down menu's in the (Project) logical Editor. I just can't seem to reach them via SF or applescript the times I've tried. SF should have access to all AXElements, but I've still yet to learn how to use all of it. My best suggestion for now is to use:

      sf.ui.cubase.appActivateMainWindow();
      sf.ui.cubase.menuClick({ menuPath: ['Edit', 'Project Logical Editor...'] });
      var projectLogicalEditorWIn = sf.ui.cubase.getWindowWithTitleStartingWith('Project Logical')
      projectLogicalEditorWIn.mouseClickElement({ relativePosition: { x: 130, y: 30 } });

      and then some simple keyboard commands with letters and arrows that'll lead you to the wanted preset, e.g.:
      sf.keyboard.press({keys: 'n,right,r,enter'});

      1. SSteve @stevef
          2018-07-31 20:14:31.536Z

          Ah yes, not sure why I didn't think of that - thanks! It's a shame we can get at them all yet - one day hopefully!

        • In reply tostevef:

          Btw. if you open the (Project) Logical Editor window and call a preset with a key command (so not the drop down menu) this will load that preset. Then you could have a code like this:

          sf.ui.cubase.appActivateMainWindow();
          sf.ui.cubase.menuClick({ menuPath: ['Edit', 'Project Logical Editor...'] });
          sf.keyboard.press({ keys: 'shift+alt+cmd+ctrl+m' }) //loads generic mute preset
          var projectLogicalEditorWIn = sf.ui.cubase.getWindowWithTitleStartingWith('Project Logical')
          projectLogicalEditorWIn.mouseClickElement({ relativePosition: { x: 460, y: 95 }, clickCount: 2 }).clickPoint; // double click where the name should be written

          This is probably faster then any other way, and you can just make an obscure key command you wouldn't use anyway.

          1. SSteve @stevef
              2018-07-31 20:19:34.585Z

              Great, I didn't realise you could call up via the Key command, I thought that was just to process - that's extremely useful to know. And yes, better to do, in case I add more presets and the preset I want move down an item or 2!

              Thanks for your help again!

              1. Sure thing. Glad I could help. Keep'em coming. It's fun to share your knowledge.

                And yes, it's cool in this instance that you can get access quickly, but if you don't realise the logical editor window is open, and you are trying to call a preset and don't get why it won't go through, than it's annoying, he he. That's how I figured out that behaviour.

            • In reply tostevef:

              Hi both @stevef and @JesperA

              In fact SF already has support for clicking anywhere in the GUI and then choosing an item on the popup menu that is shown at that point.
              It's called popupMenuSelect.

              It works like this:

              sf.ui.cubase.appActivateMainWindow();
              sf.ui.cubase.menuClick({ menuPath: ['Edit', 'Project Logical Editor...'] });
              var projectLogicalEditorWIn = sf.ui.cubase.getWindowWithTitleStartingWith('Project Logical');
              
              projectLogicalEditorWIn.popupMenuSelect({
                  menuPath: ['CMS Hide All'],
                  relativePosition: { x: 130, y: 30 }
              });
              

              As you can see, you can specify a menu path, so it should also work for items within submenus.
              There was a problem in earlier betas though, when invoking this command from non Pro Tools apps - I have fixed that now in this build:

              3.18 direct installer

              ReplySolution
              1. SSteve @stevef
                  2018-07-31 20:35:58.416Z

                  Brilliant, thanks Christian!

                  1. In reply tochrscheuer:

                    Very cool.
                    I did see some error messages about pro tools when trying the .popupMenuSelect.
                    But this will solve other ideas/problems :)

                    1. In reply tochrscheuer:
                      SSteve @stevef
                        2018-07-31 20:45:02.883Z

                        It works for Sub menus!