No internet connection
  1. Home
  2. How to

Inserting a plugin on the next available insert in PT, both Mono, or Stereo and any track type.

By Bergatron Music @Bergatron_Music
    2020-10-17 19:13:46.790Z2020-10-20 01:01:49.993Z

    Hey Everyone.

    With the help of the forum I've been able to assign a plugin to any MONO AUDIO track in Pro Tools with one click of a Stream Deck button, but I would like the same command to work on a STEREO or ANY track type (Inst) and number channels(Mono/Stereo/5.1 etc). Is this possible? Below is my script. I also used Chris Shaw's handy script for plugging into the next available insert no matter if you're on the mix or edit window!

    function ensureFirstSelectedTrackIsVisible() {
        var originallySelectedTrackNames = sf.ui.proTools.selectedTrackNames;
        sf.ui.proTools.selectedTrack.trackScrollToView();
        sf.ui.proTools.trackSelectByName({ names: originallySelectedTrackNames, deselectOthers: true });
    }
    if (sf.ui.proTools.getMenuItem('Window', 'Mix').isMenuChecked) {
        var mainWindow = "Mix";
        sf.ui.proTools.menuClick({
            menuPath: ["Window", "Edit"],
        });
        ensureFirstSelectedTrackIsVisible();
    } else {
        mainWindow = "Edit";
        ensureFirstSelectedTrackIsVisible();
    }
    function getFirstFreeInsertIndex() {
        var btns = sf.ui.proTools.selectedTrack.invalidate().insertButtons;
        for (var i = 0; i < 10; i++)
            if (btns[i].value.invalidate().value === "unassigned") return i;
        return -1;
    }
    sf.ui.proTools.selectedTrack.trackInsertOrSendSelect({
        insertOrSend: 'Insert',
        pluginNumber: getFirstFreeInsertIndex() + 1,    
        pluginPath: ['plug-in', 'EQ', 'UAD UA 610-B (mono)'],
        selectForAllSelectedTracks: true,
    });
    sf.ui.proTools.appActivate();
    sf.ui.proTools.invalidate();
    switch (mainWindow) {
        case "Mix":
        sf.ui.proTools.menuClick({
            menuPath: ["Window", "Mix"],
        });
        break;
        case "Edit":
        break;
    }
    
    Solved in post #5, click to view
    • 8 replies
    1. Chris Shaw @Chris_Shaw2020-10-17 21:43:57.704Z2020-10-17 22:33:38.625Z

      If you have a moment could you quote the code in this post by adding 3 ticks (`) before and at the end of your code? It will make it much easier to read and help you out.

      If you're sure not how, Kitch posted a video about it here:
      https://forum.soundflow.org/-3038/how-to-quote-code-in-the-soundflow-forum

      1. In reply toBergatron_Music:
        Bergatron Music @Bergatron_Music
          2020-10-17 22:16:21.216Z

          Hey Chris.
          Thanks for the tip! I'm a total newb to Java so I really appreciate all the help. I'm really loving your Edit/Mix window script as you can see! Here's my script properly pasted. Cheers.

          function ensureFirstSelectedTrackIsVisible() {
              var originallySelectedTrackNames = sf.ui.proTools.selectedTrackNames;
              sf.ui.proTools.selectedTrack.trackScrollToView();
              sf.ui.proTools.trackSelectByName({ names: originallySelectedTrackNames, deselectOthers: true });
          }
          if (sf.ui.proTools.getMenuItem('Window', 'Mix').isMenuChecked) {
              var mainWindow = "Mix";
              sf.ui.proTools.menuClick({
                  menuPath: ["Window", "Edit"],
              });
              ensureFirstSelectedTrackIsVisible();
          } else {
              mainWindow = "Edit";
              ensureFirstSelectedTrackIsVisible();
          }
          function getFirstFreeInsertIndex() {
              var btns = sf.ui.proTools.selectedTrack.invalidate().insertButtons;
              for (var i = 0; i < 10; i++)
                  if (btns[i].value.invalidate().value === "unassigned") return i;
              return -1;
          }
          sf.ui.proTools.selectedTrack.trackInsertOrSendSelect({
              insertOrSend: 'Insert',
              pluginNumber: getFirstFreeInsertIndex() + 1,    
              pluginPath: ['plug-in', 'EQ', 'UAD UA 610-B (mono)'],
              selectForAllSelectedTracks: true,
          });
          sf.ui.proTools.appActivate();
          sf.ui.proTools.invalidate();
          switch (mainWindow) {
              case "Mix":
              sf.ui.proTools.menuClick({
                  menuPath: ["Window", "Mix"],
              });
              break;
              case "Edit":
              break;
          }
          
          1. This might take a couple of days. Hang tight.

          2. In reply toBergatron_Music:

            Here you go:
            https://soundflow.org/store/insert-plugin-on-next-free-slot-intelligent
            be sure to watch the video.

            //CS//

            Reply1 LikeSolution
            1. Hey Chris. Great script. I will be using it. But a small glitch. When I change desktops on my mac (ie web browser), and return to my Pro Tools desktop, the script will run. Pretty funny glitch

              -Con

              1. I disabled "When Pro Tools becomes active" trugger, and glitch is gone. Makes sense :)

            2. In reply toBergatron_Music:
              Bergatron Music @Bergatron_Music
                2020-10-21 19:58:01.855Z

                Thank you Chris! I'll watch now.
                Cheers.
                -Brian

                1. In reply toBergatron_Music:
                  Bergatron Music @Bergatron_Music
                    2020-10-21 20:18:28.501Z

                    This is insane Chris!

                    Works awesome! You've simplified it so much. I really appreciate it. Thank you!
                    -Brian