No internet connection
  1. Home
  2. How to

Opening Inserts from Sends

By Andrew Downes @Andrew_Downes
    2022-03-24 03:23:02.845Z

    Hi There
    I am wondering if its possible to be able to open the plugin that is associated with the send that's sending to it, for example
    If the send (bus) is named "AMS" and the return (Aux Input) is named AMS is it possible to have the plugin window open when you select the send?
    It would be good also if it didn't have to scroll to the track with the insert on it as they are usually at the bottom of the session
    Thank you

    • 24 replies

    There are 24 replies. Estimated reading time: 19 minutes

    1. @Andrew_Downes, recently wrote something similar to this. Tailored it for your needs.

      At the bottom of the script, adjust which send you'll like to reference and which insert you'll like to open. As it is set up right now, it will open the first insert of the first track that has an input that matches the name of the first send on the selected track.

      Give it a shot!

      /** @param {{ sendNumber?: number, insertNumber?: number }} args */
      function openInsertOfSelectedTrackSendReturnTrack({ sendNumber = 1, insertNumber = 1 } = {}) {
          sf.ui.proTools.appActivateMainWindow();
          sf.ui.proTools.mainWindow.invalidate();
      
          const selectedTrackSendName = sf.ui.proTools.selectedTrack.sendButtons[sendNumber - 1].value.value;
      
          const firstTrackWithSelectedTrackSendAsInput = sf.ui.proTools.visibleTracks.trackHeaders.find(track => {
              if (track.inputPathButton.exists) {
                  return track.inputPathButton.value.value === selectedTrackSendName;
              }
          });
      
          if (!firstTrackWithSelectedTrackSendAsInput) throw `No track with input "${selectedTrackSendName}" found.`
      
          firstTrackWithSelectedTrackSendAsInput.trackInsertToggleShow({ insertNumber });
      }
      
      openInsertOfSelectedTrackSendReturnTrack({
          sendNumber: 1,
          insertNumber: 1
      });
      
      1. TTom Weber @Tom_Weber
          2024-11-05 23:01:19.891Z

          Hi this works great! Now I try to open the second send to the first insert of a second Reverb Track. Typical situation in the audio post. For each group of FX or BG tracks I need two reverb tracks to use the reverbs alternately. But I can't manage to rewrite the script. Thank you for your help.

          1. On this script, all you'd have to do is change the sendNumber value at Line 20 to whichever send you'd like to address.
            In this case, it would be sendNumber: 2.

            1. TTom Weber @Tom_Weber
                2024-11-06 08:15:43.236Z

                Thnx me dummy...that was easy.

                1. TTom Weber @Tom_Weber
                    2024-11-06 21:17:46.934Z

                    Hi Raphael, thanks for helping it is nearly working great. How can I manage that in the same time the send open up so that I have the send and the insert present.
                    I know this Command is available but in Combination...???
                    Thank you Tom

                    1. Raphael Sepulveda @raphaelsepulveda2024-11-14 18:29:20.776Z2024-12-05 21:19:10.186Z

                      Hey @Tom_Weber, here's a version that will also open the send for you.
                      Following on your last inquiry, this script is currently set up to open Send 2, and Insert 2 on the return track. Just like last time, if you'd like to change that, you can do so at the bottom of the script.

                      /**
                       * @param {object} [args]
                       * @param {1|2|3|4|5|6|7|8|9|10} [args.sendNumber] - Send leading to return track
                       * @param {1|2|3|4|5|6|7|8|9|10} [args.insertNumber] - The insert to be opened
                       * @param {boolean} [args.isOpenSend] - Open the send output window?
                       */
                      function toggleOpenReturnInsert(args = {}) {
                          const { sendNumber = 1, insertNumber = 1, isOpenSend = false } = args;
                      
                          sf.ui.proTools.appActivateMainWindow();
                          sf.ui.proTools.mainWindow.invalidate();
                      
                          const selectedTrack = sf.ui.proTools.selectedTrack;
                          const sendButton = selectedTrack.sendButtons[sendNumber - 1];
                          const sendName = selectedTrack.sendButtons[sendNumber - 1].value.value
                              .replace(/^> /, ""); // Remove ">" PT adds to fanned send names
                      
                          const returnTrack = sf.ui.proTools.visibleTracks.trackHeaders.find(track => {
                              if (track.inputPathButton.exists) {
                                  return track.inputPathButton.value.value === sendName;
                              }
                          });
                      
                          if (!returnTrack) throw `No track with input "${sendName}" found.`
                      
                          returnTrack.trackInsertToggleShow({ insertNumber });
                      
                          if (isOpenSend) sendButton.elementClick();
                      }
                      
                      toggleOpenReturnInsert({
                          sendNumber: 2,
                          insertNumber: 2,
                          isOpenSend: true
                      });
                      
                      1. TTom Weber @Tom_Weber
                          2024-11-17 10:35:33.803Z

                          Thank you Raphael, this works very well. As a no programmer I asked you just for my clarification: Is it possible that a script which is used for soundflow is making changes in the system settings...I have no idea. I ask cause I cannot get acces anymore to the recovery mode of may mac mini M2Pro. And the apple support has no idea why is this?

                          1. @Tom_Weber, while SoundFlow is capable of changing certain system settings, such as switching between audio devices, I don't think that it is the cause of your issue. You'd have to run a script that changes a setting explicitly and I am not aware of a setting or a way to cause recovery mode not to work. Certainly haven't seen a script here in the forum that interacts with that part of the system. I would encourage you to keep working with Apple to try and figure out what could be the root of the problem.

                            1. TTom Weber @Tom_Weber
                                2024-11-18 21:38:08.745Z

                                thnx
                                Tom

                            2. TTom Weber @Tom_Weber
                                2024-11-28 23:15:49.367Z2024-11-29 13:36:09.951Z

                                Hi Raphael, as I said this is working very good....but only with mono or stereo channels on the send side. If mono or stereo the send Fader and the corresponding plugin opens. I have the same config on multichannel tracks. If I fire i.e. the command for send1 I get the error message:
                                !! Command Error: Send1/Insert1 [user:default:cm34yxbbe00019d10xx8g8f7x]:
                                No track with input "> BGB Reverb Bus 1" found.
                                There is no Send Bus with this name only the name is "BGB Reverb Bus 1" but the fanned Output to the 7.1.2 bed has the " > " prefix. Anyway do you understand what I am trying to say? Thnx for help Tom

                                1. TTom Weber @Tom_Weber
                                    2024-11-29 13:20:58.085Z2024-11-29 13:38:51.709Z

                                    Hi Raphael, I think it would work without the " > " only " BGB Reverb Bus 1 " will do the job.

                                    1. Hey @Tom_Weber, I don't work with surround formats so I'm having a little trouble recreating your setup. I created a send from a Stereo track to a 7.1.2 aux but no ">" was added to the bus name.

                                      Could you take a screenshot for me? I'd like to see the name of the send as well as the name of the input of the return track.

                                      As you suggested, it's a matter of ignoring that additional ">". I just want to make sure if it only happens in one place or both.

                                      1. TTom Weber @Tom_Weber
                                          2024-12-04 09:54:04.885Z

                                          Hi Raphael, thnx for your reply. I will sent what you asked for as soon I have access to my studio asap.

                                          1. TTom Weber @Tom_Weber
                                              2024-12-05 20:51:22.747Z

                                              Hi Raphael, back from the hospital and on my desk again...yeah. On the Sreen shot you will see the sends and the returns. I was wrong as I only use stereo sends the sends will be fanned to match the track (plugin format) and the ">" will be add to the send name. On the return site the plugin format is i.e. Altiverb 7.0.2 so the stereotrack changes to a 7.0.2 Track without the ">". It is not fanned. ">" is a sign for a fanned or foldet track. I hope the screenshot will help. If not please tell me what you need.
                                              Thank you very much Tom

                                              1. Raphael Sepulveda @raphaelsepulveda2024-12-05 21:25:34.516Z2024-12-06 17:41:11.031Z

                                                Hey Tom, so sorry to hear about the hospital. Hopefully you're doing okay.

                                                Your screenshot and explanation were splendid. I was able to recreate the fanned send and fix the issue with the script. I've updated it above.

                                                All that changed was line 15. From this:

                                                    const sendName = selectedTrack.sendButtons[sendNumber - 1].value.value;
                                                

                                                To this:

                                                    const sendName = selectedTrack.sendButtons[sendNumber - 1].value.value
                                                        .replace(/^> /, ""); // Remove ">" PT adds to fanned send names
                                                

                                                Give it a try and let me know how it goes.

                                                1. TTom Weber @Tom_Weber
                                                    2024-12-06 10:01:28.963Z

                                                    Hi Raphael, it works perfectly. This is a great addon. Now it is very easy to open the send and the corresponding Return plugin.
                                                    Thank you very much. Cheers tom

                                                    1. No problem, enjoy!

                                2. A
                                  In reply toAndrew_Downes:
                                  Andrew Downes @Andrew_Downes
                                    2022-03-25 21:28:33.961Z

                                    This is excellent Raphael thank you very much!
                                    Is it possible though to have the name of the bus as the trigger rather than the send number? I would like it to open the corresponding plugin regardless of which send slot is used.
                                    Ultimately I am trying to have the plugin window open whenever i open the send that relates to it
                                    The insert number on the return track is always 1 and while I try to use the the same send number for each track, sometimes I can't.
                                    I hope I'm making sense!
                                    Thank you.

                                    1. Yeah!

                                      Taking your AMS example, the way this one works is that if the selected track has a send going to an AMS bus (no matter the send slot), it will open that send output window as well as the first insert of the AMS aux track.

                                      /** @param {{ sendBusName?: string, insertNumber?: number }} args */
                                      function openSendAndReturnInsertOfSelectedTrack({ sendBusName, insertNumber = 1 } = {}) {
                                          sf.ui.proTools.appActivateMainWindow();
                                          sf.ui.proTools.mainWindow.invalidate();
                                      
                                          const targetSendButton = sf.ui.proTools.selectedTrack.sendButtons.find(sendButton => {
                                              return sendButton.value.value === sendBusName
                                          });
                                      
                                          if (!targetSendButton) throw `No send to "${sendBusName}" found in selected track.`
                                      
                                          const firstTrackWithSendBusNameAsInput = sf.ui.proTools.visibleTracks.trackHeaders.find(track => {
                                              if (track.inputPathButton.exists) {
                                                  return track.inputPathButton.value.value === sendBusName;
                                              }
                                          });
                                      
                                          if (!firstTrackWithSendBusNameAsInput) throw `No track with input "${sendBusName}" found.`
                                      
                                      
                                          targetSendButton.elementClick();
                                          firstTrackWithSendBusNameAsInput.trackInsertToggleShow({ insertNumber });
                                      }
                                      
                                      openSendAndReturnInsertOfSelectedTrack({
                                          sendBusName: 'AMS',
                                          insertNumber: 1
                                      });
                                      
                                    2. A
                                      In reply toAndrew_Downes:
                                      Andrew Downes @Andrew_Downes
                                        2022-03-27 22:29:30.014Z

                                        This is perfect, Thank you Raphael!
                                        How would I go about not having the send window open at the same time?
                                        I have it set up on a streamdeck so a single button push opens the send window but a shift/button push opens the return.
                                        Many thanks again!

                                        1. A
                                          In reply toAndrew_Downes:
                                          Andrew Downes @Andrew_Downes
                                            2022-03-27 23:22:34.293Z

                                            Now I think about it some more I realise it won't work as the send doesn't always know what its being sent to.
                                            eg, if send 1 is not AMS, its Echofarm then how will it know that its Echofarm instead of AMS...
                                            Is there a way of using wildcards maybe?

                                            1. Just so that I make sure I'm understanding correctly. You'd like to address whichever send is sending to a reverb, and open that reverb plugin, no matter what reverb or in which send slot it is, right?

                                              If that's the case then I would suggest putting a suffix on the bus name, such as “AMS Verb” or “Echofarm Verb”, that way I can have the script look for a send that ends in “Verb” or whichever suffix you prefer. What do you think?

                                              1. AAndrew Downes @Andrew_Downes
                                                  2022-03-29 23:01:13.670Z

                                                  Here is my situation. I have 12 plugins that are in my mix template that I would like to be able to address with this script so its a little less random than just any plugin at any time!
                                                  What I am really trying to achieve is the ability to be anywhere in my session, instansiate a send to something and have the plugin open so I can select settings and so forth, without having to scroll down to wherever the track is in the session. This why I thought of the wildcard thing as it will only be 1 of 12 things at a time.
                                                  Possible?
                                                  Thank you

                                              2. M
                                                In reply toAndrew_Downes:
                                                Martin Pavey @Martin_Pavey
                                                  2024-11-06 21:28:29.000Z

                                                  This is the best one I've found on the Forum.
                                                  It will open all the plugins on the destination track of any send that is open on an attentioned track.
                                                  Sorry I can't give the person who scripted it credit as I can't remember which thread I found it in.

                                                  /**
                                                  * @param {string} insertChar
                                                  * @param {Object} track
                                                  */
                                                  function getInsertWin(track, insertChar) {
                                                      /*   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];
                                                  }
                                                  
                                                  
                                                  /**
                                                  * @param {array} inserts
                                                  * @param {Object} track
                                                  */
                                                  function openInsertWin(track, inserts) {
                                                  
                                                      const insertChars = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'];
                                                      const winPositions = []
                                                  
                                                      for (let i = 0; i < inserts.length; i++) {
                                                  
                                                          const insertN = insertChars.indexOf(inserts[i])
                                                  
                                                          if (!track.insertButtons[insertN].invalidate().exists) continue;
                                                          if (track.insertButtons[insertN].value.value === "unassigned") continue;
                                                  
                                                          let pluginWin = getInsertWin(track, inserts[i]);
                                                  
                                                  
                                                  
                                                          if (!pluginWin) {
                                                              track.insertButtons[insertN].elementClick();
                                                  
                                                              while (true) {
                                                                  pluginWin = getInsertWin(track, inserts[i]);
                                                                  if (pluginWin) break;
                                                                  sf.wait({ intervalMs: 100 });
                                                              };
                                                  
                                                              const targetBtn = pluginWin.buttons.whoseTitle.is('Target button').first
                                                  
                                                              // The next lines will moove the plugin windows side by side
                                                              // if (i === 0) winPositions.push(targetBtn.invalidate().position)
                                                              //if (i > 0) {
                                                              //  pluginWin.windowMove({ position: { x: winPositions.slice(-1)[0].x + 21, y: pluginWin.position.y } })
                                                              //winPositions.push(targetBtn.invalidate().position)
                                                              // };
                                                              ////////////////////////////////////////////////////////////////////////////////
                                                  
                                                              //Disable target mode on newly opened window
                                                              targetBtn.elementClick();
                                                  
                                                          };
                                                      };
                                                  };
                                                  
                                                  function getSelectedSendNumber() {
                                                  
                                                      //Check if send is selected
                                                      const outputWin = sf.ui.proTools.mainTrackOutputWindow
                                                      const outputViewSelector = outputWin.buttons.whoseTitle.is("Output View selector").first
                                                      if (!outputWin.exists || !outputViewSelector.value.invalidate().value.startsWith("send")) { alert("Please select a send."); throw 0 };
                                                  
                                                      return outputViewSelector.value.invalidate().value.replace("send ", "").charCodeAt(0) - 96
                                                  };
                                                  
                                                  
                                                  sf.ui.proTools.selectedTrack.trackSendGotoReturn({
                                                      sendNumber: getSelectedSendNumber(),
                                                  });
                                                  
                                                  const returnTrack = sf.ui.proTools.selectedTrackHeaders[0];
                                                  
                                                  openInsertWin(returnTrack, ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"]);