No internet connection
  1. Home
  2. How to

Toggle insert Plugin visability similar to audiosuite

By Houston Snyder @Houston_Snyder
    2020-04-02 16:25:52.778Z

    Hey!

    I've seen the discussions around toggling the visibility of audiosuite plugins. Is this possible to do with a plugin inserted on a track?

    Solved in post #4, click to view
    • 13 replies
    1. H
      Houston Snyder @Houston_Snyder
        2020-04-02 17:11:08.208Z

        Nevermind! Just found the macro to do it.

        1. H
          In reply toHouston_Snyder:
          Houston Snyder @Houston_Snyder
            2020-04-02 17:26:20.580Z2020-04-02 17:49:30.884Z

            Actually the macro "Open insert on track" works. It will toggle my dorrough meter open and close. But, as soon as i turn the target button off. It stops functioning. Any ideas how to solve? Here is the script from that macro.

            sf.ui.proTools.trackGetByName({ name: "MASTERBUS", makeVisible: true }).track.trackInsertToggleShow({
                insertNumber: 4,
            });
            
            1. Hi Houston.

              Yes trackInsertToggleShow only works on the targeted insert in that slot.

              If you want to close the insert, you'll need a script that finds the window and if it finds it, to close it.

              Something like this:

              
              function toggleUntargetedInsertPlugin({ pluginName, trackName, insertNumber }) {
                  var pluginWindow = sf.ui.proTools.floatingWindows.whoseTitle.is('Plug-in: ' + pluginName).filter(w => {
                      var trackSelectorBtn = w.popupButtons.whoseTitle.is('Track Selector').first;
                      return trackSelectorBtn.exists && trackSelectorBtn.value.invalidate().value === trackName;
                  })[0];
                  if (pluginWindow && pluginWindow.exists) {
                      //Plugin is open, so close it
                      pluginWindow.windowClose();
                  }
                  else {
                      //Plugin is not open, so open it
                      var newPluginWindow = sf.ui.proTools.trackGetByName({ name: trackName, makeVisible: true }).track.trackInsertToggleShow({
                          insertNumber,
                      }).window;
                      //Untarget plugin
                      newPluginWindow.buttons.whoseTitle.is('Target button').first.elementClick();
                  }
              }
              
              toggleUntargetedInsertPlugin({
                  trackName: 'MASTERBUS',
                  pluginName: 'Dorrough',
                  insertNumber: 1,
              });
              
              ReplySolution
              1. You could experiment with adding a windowMove action after the untarget call, to make sure the window always ends up on the same place on your screen (PT won't remember it):

                        newPluginWindow.windowMove({
                            position: { x: 400, y: 400 },
                        });
                
                1. HHouston Snyder @Houston_Snyder
                    2020-04-02 20:20:27.531Z

                    Both Scripts worked perfectly! I was also able to make multiple plugins open. So like I can toggle all my comps up and down or all the master bus stuff. Super useful! Thanks as always!

                    1. Thanks for coming up with good ideas :) I will definitely use this as well.

                  • In reply tochrscheuer:
                    SScott Robinson @Scott_Robinson
                      2025-05-01 21:16:01.478Z

                      Hi Christian, is there a way to simulate a “shift click” when opening the plugin?

                      1. Chad Wahlbrink @Chad2025-05-02 21:40:29.893Z

                        Hi, @Scott_Robinson,

                        You can simulate a shift click for an insert like this:

                        sf.ui.proTools.selectedTrack.insertButtons[0].mouseClickElement({ isShift: true })
                        

                        or as a Macro like this:

                        This is a bit less robust than addressing the "Target Button" with elementClick(), as Christian did above. Mouse and Keyboard simulation, using `mouseClickElement()', requires the element to be shown on screen and for Pro Tools to be focused. As a result, it's more prone to errors.

                        elementClick() can run in the background and uses deeper accessibility hooks to ensure reliability; however, it cannot accept keyboard modifiers like a mouseClick.

                        1. SScott Robinson @Scott_Robinson
                            2025-05-03 16:04:20.765Z

                            Thanks Chad, do you know if elementClick() is still the best way to open a plugin window?

                            1. Chad Wahlbrink @Chad2025-05-03 20:11:35.415Z

                              The SoundFlow team generally tries to use elementClick() over mouseClickElement() for most actions.

                              Since we can reliably use elementClick() to open the plug-in window and then use elementClick() on that plug-in's window after it's open, that would be recommended.

                              I don't believe there is a SDK command for this function yet.

                    • D
                      In reply toHouston_Snyder:
                      Daniel Lee @Daniel_Lee
                        2020-04-14 15:28:42.252Z

                        Hi Houston & Christian, just curious as to what are the advantages of this command over using windows configuration?

                        1. I think they're just two different tools.
                          What immediately comes to mind for me is:

                          • Window configurations are full (and fairly static) configurations of your setup, where these scripts allow you to dynamically change the visibility of individual plugins via shortcuts. You might want to just ensure that one plugin is shown, but not change anything else.
                          • In some cases window configs can be slow to load.
                          1. DDaniel Lee @Daniel_Lee
                              2020-04-15 12:21:23.430Z

                              Ah ok! Got it!

                              Thanks Christian!