No internet connection
  1. Home
  2. How to

Clicking a Plug-In Window in Cubase 13

By Julian Worden @McJulian
    2024-10-08 20:36:50.001Z

    Hello, we are attempting to do some scripting with SoundFlow in Cubase 13 and I'm running into an issue. It's my understanding (because of my post here: Current State of Cubase Support #post-3) that SoundFlow doesn't fully support Cubase 13 at the moment. That said, some code appears to work while some doesn't, so I'm just trying to make sure I'm not doing anything wrong before I give up.

    I'm currently using some coordinates to click and drag a knob on a plug-in UI. These coordinates are relative to the top left corner of the plug-in UI, NOT including the toolbar that Cubase the plug-in UI for bypassing, changing presets, etc. It looks like I'm able to use SoundFlow's Pick button to highlight and select this portion of the UI. This code looks like this: sf.ui.cubase.mainWindow.groups.whoseTitle.is("4020 Retro EQ").first.groups.first;

    I then have this code to click a parameter on the UI:

    sf.ui.cubase.mainWindow.groups.whoseTitle.is("4020 Retro EQ").first.groups.first.mouseClickElement({
        relativePosition: { "x": 100, "y": 100 },
        isRightClick: false,
    });
    

    However, when I run this code, I get this error

    08.10.2024 13:27:48.21 <info> [Backend]: !! Command Error: Script [user:<insertIDHere>]:
    MouseClickAction requires valid UIElement (01 retroEQ: Line 165) // Line 165 is the line with the mouseClickElement call
        Couldn't get item #0 as the array's parent node wasn't found - sf.ui.app('com.steinberg.cubase13').<unknown>.groups.whoseTitle.is('4020 Retro EQ').first (AxElementArrayIndexedItem)
    

    This suggests to me that, although the Pick tool is able to select my desired portion of the UI, SoundFlow isn't able to successfully target it. This is strange to me because the following code DOES work and does not produce this error:

    sf.ui.cubase.mainWindow.mouseClickElement({
        relativePosition: { "x": 100, "y": 100 },
        isRightClick: false,
    });
    

    While this does work, the main issue with this is that this would require us to alter all of our parameter coordinates to work from the top left corner of the Cubase window, as opposed to the top left corner of the plug-in UI. This would also require all of our plug-in UIs to be in a specific spot in Cubase before running the script. Of course, we'd prefer to avoid this approach, if possible.

    So, could you please clarify if the behavior that I'm experiencing is expected due to the lack of support for Cubase? Or is there another way I should go about getting a reference to this portion of the plug-in UI so that our coordinates line up with our parameters as expected?

    As always, thank you so much!

    Solved in post #9, click to view
    • 11 replies
    1. Hi @McJulian,

      I think the most likely reason is that you might need to invalidate the mainWindow for this to work, in case the plugin window has been opened or closed recently.

      I'll let @Chad chime in for troubleshooting.

      1. MJulian Worden @McJulian
          2024-10-11 18:09:07.670Z

          Christian,

          Got it! Thank you, I'll keep an eye out for a response from Chad because I've never had to do that before so I'm not sure how it works.

        • In reply toMcJulian:
          Chad Wahlbrink @Chad2024-10-11 19:20:58.701Z

          Hi @McJulian!

          I don't own a Cubase license, so it may be hard for me to test. However, I'm happy to troubleshoot based on my knowledge of SoundFlow.

          As Christian mentioned, the first thing to test would be invalidating the main window.

          For your code, this would look like:

          sf.ui.cubase.mainWindow.invalidate().groups.whoseTitle.is("4020 Retro EQ").first.groups.first.mouseClickElement({
              relativePosition: { "x": 100, "y": 100 },
          });
          

          Note—I removed isRightClick: false, as this property's default value is false, so it shouldn't need to be specified.

          It's interesting that the plugin window would be considered part of the mainWindow in Cubase. In pro tools, similar code would look like this:

          sf.ui.proTools.windows.whoseTitle.is("Plug-in: EchoBoy").first.mouseClickElement({
              relativePosition: {x: 100, y: 100},
              })
          

          For more information on invalidation, you can check out this post:

          1. MJulian Worden @McJulian
              2024-10-14 17:39:21.594Z

              Chad,

              Thank you, got it! Yes I agree that it's strange that the plug-in window seems to be considered part of mainWindow. That is what the Pick tool gave me, though.

              I will give this a shot today and let you know if I have any luck.

              1. MJulian Worden @McJulian
                  2024-10-14 20:10:03.888Z

                  @Chad,

                  Unfortunately, I'm still seeing the same error, even with your invalidate() call.

                  Do you have any other suggestions? If not, I'm going to move forward with just coming up with an offset for our coordinates so that they can still be usable from the top left of the Cubase window.

                  Thanks!

                  1. Chad Wahlbrink @Chad2024-10-14 20:36:25.968Z

                    Hi @McJulian.

                    My only other suggestion is that we hop on a quick Zoom call and briefly examine the specific UI elements you are trying to address together. Otherwise, I'm limited in what I can test without a Cubase license.

                    If that sounds good, contact support@soundflow.org, and we'll set it up.

                    Thanks!

                    1. MJulian Worden @McJulian
                        2024-10-15 18:40:57.433Z

                        Chad,

                        Got it, reaching out now!

                        1. Chad Wahlbrink @Chad2024-10-17 19:18:20.013Z

                          Thanks, @McJulian!

                          To recap, we switched:

                          sf.ui.cubase.mainWindow.groups.whoseTitle.is("4020 Retro EQ").first.groups.first
                          

                          to explicitly call the bundle ID for Cubase 13.

                          sf.ui.app('com.steinberg.cubase13').mainWindow.groups.whoseTitle.is("4020 Retro EQ").first.groups.first
                          
                          ReplySolution
                          1. Thanks guys. I wonder if this happens due to having multiple installed versions of Cubase on the computer. In that case, if you switch between them, you'd have to invalidate on the app level, not the mainWindow level (ie. sf.ui.cubase.invalidate().mainWindow...)

                            1. MJulian Worden @McJulian
                                2024-10-18 16:21:47.422Z

                                Christian,

                                Good suggestion! I'll give that a shot too. We do have multiple Cubase versions installed, but I'm only ever running one at a time.

                                Thanks again for taking the time, Chad!

                                1. We do have multiple Cubase versions installed, but I'm only ever running one at a time.

                                  Cool! The error is consistent with what would happen if SoundFlow had run code related to a Cubase instance of one version, and another instance of Cubase was then later launched with a new version of Cubase, but SF still running (so SF would've cached the bundle ID associated with Cubase to be the wrong version's bundle ID). The invalidate() call at the app level would properly clear that cache, allowing the currently running version of Cubase to be identified.