No internet connection
  1. Home
  2. How to

Open all plug in windows on selected track

By Jonathan Grossman @Jonathan_Grossman
    2020-10-22 22:44:50.054Z

    Is there a way to open ALL plug-ins on the selected track? and then close all of them with the same macro

    • 7 replies
    1. Something like this should open all inserts on the selected track:

      let track = sf.ui.proTools.selectedTrack;
      
      function getInsertWin(track, insertIndex) {
          const insertChars = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'];
          const insertChar = insertChars[insertIndex];
          const trackName = track.normalizedTrackName;
          return sf.ui.proTools.windows.whoseTitle.startsWith('Plug-in:').filter(w => {
              if (w.popupButtons.whoseTitle.is('Track Selector').first.value.value !== trackName) return false;
              if (w.popupButtons.whoseTitle.is('Insert Position selector').first.value.value !== insertChar) return false;
              return true;
          })[0];
      }
      
      for (let i = 0; i < 10; i++) {
      
          if (!track.insertButtons[i].invalidate().exists) continue;
          if (track.insertButtons[i].value.value === "unassigned") continue;
      
          let pluginWin = getInsertWin(track, i);
      
          if (!pluginWin) {
              track.insertButtons[i].elementClick();
      
              while (true) {
                  pluginWin = getInsertWin(track, i);
                  if (pluginWin) break;
                  sf.wait({ intervalMs: 100 });
              }
      
              //Disable target mode on newly opened window
              pluginWin.buttons.whoseTitle.is('Target button').first.elementClick();
          }
      
      }
      

      I'd then use one of our functions that deal with closing all floating windows to close them again.

      1. This is a great start....thank you!

        Can we adjust so the plug in windows array across the screen? Right now they all open on top of each other. Also, can this same button then close these window when done? Closing ALL currently open floating windows won't work bc I have several metering plug ins always floating.

        1. Arranging plugin windows is a much larger task, not a simple one, unfortunately.
          You're more than welcome to try out algorithms - using the windowMove action.

          1. ok - thanks.

            sadly this script isn't working now tho. It worked fine, then I was working another script ( from the post titled "Select Track as trigger") and since then this script stopped working. I'm wondering if something about the "run forever" part of that other script is now interfering? I tried deleting the script. Stopping all macros. Restarting SF and PT. nothing will get the "Open All Plug-in Windows on Selected Track" to work tho.

            1. Can you be more specific in describing what you mean by "not working"?

              Please see this guide for how to best get help with a script:

              1. When I run the command, absolutely nothing happens, as though the code isn’t complete.

                1. Thanks, Jonathan. Can I get you to follow the "1st priority: Get help on a specific script or macro" guidelines as mentioned in the link above (How to get help with SoundFlow)? That will give us a complete copy of your script & log files, which will help us understand what's going on.

                  The best way to do this, is to run the script and then immediately after seeing the error (which in this case is that nothing happens), then use the Help workflow outlined. That way the interesting part of the log file will be at the end, and so will be easier for us to locate.