No internet connection
  1. Home
  2. How to

Open multiple AudioSuite plugins

By Reid Caulfield @Reid_Caulfield
    2021-08-02 20:11:27.815Z

    Is there a way for me to interrogate the open/closed state of multiple AS plugins and open if closed? This would obviously involve hitting the red target button on each if and as it opened.

    • 1 replies
    1. Kitch Membery @Kitch2021-08-03 00:20:05.779Z

      Hi @Reid_Caulfield,

      Unfortunately there is no way to read the state of the "Red Target Button" on AudioSuite plugins however, a script like this should work for what you want;

      const audioSuitePlugins = [
          { category: 'EQ', name: 'EQ3 1-Band', },
          { category: 'Avid', name: 'D-Verb', },
          { category: 'EQ', name: 'F6 Mono', },
          { category: 'Other', name: 'Gain', },
      ];
      
      function openAudioSuitePlugin(category, name) {
          sf.ui.proTools.audioSuiteOpenPlugin({
              category: category,
              name: name,
          });
      }
      
      function clickAudioSuiteTargetBtn(pluginName) {
          const win = sf.ui.proTools.windows.whoseTitle.endsWith(pluginName)[0];
      
          win.buttons.whoseTitle.is("Target button").first.elementClick();
      }
      
      function openAudioSuitePlugins() {
          // Activate Pro Tools Main Window
          sf.ui.proTools.appActivateMainWindow();
      
          // Check to see if AudioSuite window exists
          let audioSuiteWindowExists = (pluginDetails) => sf.ui.proTools.windows
              .map(x => x.title.invalidate().value.split(': ')[1] === pluginDetails)
              .some(x => x === true);
      
          // Get open state of AudioSuite plugins.
          let audioSuitePluginState = audioSuitePlugins.map(pluginInfo => ({
              name: pluginInfo.name,
              category: pluginInfo.category,
              isOpen: audioSuiteWindowExists(pluginInfo.name),
          }));
      
          // Create an array of plugins to open
          const pluginsToOpen = audioSuitePluginState.filter(x => x.isOpen === false);
      
          // Open plugins if they are not already open.
          pluginsToOpen.forEach(plugin => {
              openAudioSuitePlugin(plugin.category, plugin.name);
              clickAudioSuiteTargetBtn(plugin.name);
          });
      }
      
      openAudioSuitePlugins();
      

      Let me know if you need any further explanation. :-)

      Rock on!