No internet connection
  1. Home
  2. How to

Select Tracks by Output Name

By Philip weinrobe @Philip_weinrobe
    2022-03-08 13:58:25.014Z

    hello geniuses!

    i'm trying to figure out a way to select all tracks assigned to a specific bus.
    for example:
    i want a script that selects all tracks with an output or input titled "INST"
    how can i write a script that does this?
    pro tools has a feature called "select assignment to" but i can't seem to get at that with soundflow (and my limited skills)

    thank you!
    philip

    • 19 replies

    There are 19 replies. Estimated reading time: 14 minutes

    1. E
      Eli Crews @Eli_Crews
        2022-08-30 20:27:46.187Z

        Ever figure this out? I wanna do the same thing

        1. samuel henriques @samuel_henriques
            2022-08-31 00:02:29.309Z2022-08-31 07:13:01.984Z

            Hello,

            Try this.
            Just replace "Analog 1-2"on the last line with the output name you want.

            /**
            * @param {string} findName
            * @param {'Input'|'Output'} inOut
            */
            function selectTracksWithOutputName(inOut, findName) {
                sf.ui.proTools.appActivateMainWindow();
            
            
                const tracksWithRoutingName = [];
                const visibleTracks = sf.ui.proTools.visibleTrackHeaders;
            
                visibleTracks.forEach(track => {
            
                    let routing
                    inOut === "Input" ? routing = track.inputPathButton : routing = track.outputPathButton
            
                    if (routing.exists && routing.value.invalidate().value === findName) {
                        tracksWithRoutingName.push(track.normalizedTrackName);
                    };
            
                });
                sf.ui.proTools.trackSelectByName({ names: tracksWithRoutingName });
            };
            
            
            
            
            selectTracksWithOutputName("Output", "BUS M+FX")
            
            1. EEli Crews @Eli_Crews
                2022-08-31 00:17:33.834Z

                Thank you for this, but it is selecting every track, regardless of output assignment.

                1. samuel henriques @samuel_henriques
                    2022-08-31 00:37:26.923Z

                    Yep, sorry Eli left an extra ; by mistake.

                    try now

                    1. samuel henriques @samuel_henriques
                        2022-08-31 00:44:11.029Z

                        And Updated with a version to work with inputs or Outputs

                        Set Input or Output and the name here:

                        selectTracksWithOutputName("Output", "Analog 1-2")
                        
                        1. EEli Crews @Eli_Crews
                            2022-08-31 00:48:20.798Z

                            Amazing!! It was actually acting funny for a minute but I put it in a macro with a Deselect All Tracks right before it, and now it works perfectly, thank you so much!

                            1. PPhilip weinrobe @Philip_weinrobe
                                2022-09-01 20:04:22.373Z

                                i came up with another work around for this. Eli, hit me up if you are trying to do what i think you are trying to do...lol

                              • Ben Rubin @Ben_Rubin
                                  2023-02-21 03:55:20.768Z

                                  thanks so much for this @samuel_henriques. Really useful. How could I modify this to select multiple outputs? I'd imagine it invovles holding donwn the command key.

                                  1. samuel henriques @samuel_henriques
                                      2023-02-21 19:04:52.986Z2023-02-21 20:09:03.511Z

                                      Hello Ben,
                                      I didn't quite get what you asked so I managed to do all the "select multiple outputs" options I could think of.
                                      With this version you can make a list of all the output names you want to select,
                                      and it will search on all the output paths assigned for the track for any output name from you list.

                                      I hope this works.

                                      /**
                                      * @param {Object} param
                                      * @param {string[]} param.searchNameArr
                                      * @param {'Input'|'Output'} param.pathButtonType
                                      */
                                      function selectTracksByPathBtnValue({ pathButtonType, searchNameArr }) {
                                          sf.ui.proTools.appActivateMainWindow();
                                      
                                      
                                          const trackNamesToSelect = [];
                                          const visibleTracks = sf.ui.proTools.visibleTrackHeaders;
                                      
                                          visibleTracks.forEach(track => {
                                      
                                              let pathBtn = pathButtonType === "Input" ? track.inputPathButton : track.outputPathButton;
                                              if (pathBtn.exists) {
                                      
                                                  let pathAssignmentNames = pathButtonType === "Input" ? [pathBtn.value.invalidate().value] : pathBtn.title.invalidate().value.split("\n");
                                      
                                                  let foundSearchName = pathAssignmentNames.find(assignmentName => searchNameArr.find(searchName =>
                                                      assignmentName.indexOf(" (") === -1 ?
                                                          assignmentName === searchName
                                                          : assignmentName.split(" ").slice(0, -1).join(" ") === searchName));
                                      
                                                  if (foundSearchName) {
                                                      trackNamesToSelect.push(track.normalizedTrackName);
                                                  };
                                              };
                                          });
                                      
                                          sf.ui.proTools.trackSelectByName({ names: trackNamesToSelect });
                                      };
                                      
                                      
                                      
                                      
                                      selectTracksByPathBtnValue({ pathButtonType: "Output", searchNameArr: ["BUS DIAL", "MASTER MIX"] });
                                      
                                      1. Ben Rubin @Ben_Rubin
                                          2023-02-22 14:41:23.377Z

                                          thanks much. not sure why but this script doesn't run at all.

                                          what i am trying to do is tell Pro Tool to select any track with specific outputs. for example "Output 1" "Output 2" and "Output 3". does that make sense?

                                          thanks
                                          ben

                                          1. samuel henriques @samuel_henriques
                                              2023-02-22 15:04:36.571Z2023-02-22 15:33:45.499Z

                                              Thats what it should do,
                                              if you replace in the last line ["BUS DIAL", "MASTER MIX"]
                                              with `["Output 1", "Output 2", "Output 3"]

                                              1. Ben Rubin @Ben_Rubin
                                                  2023-02-26 01:04:44.197Z

                                                  yeah, that's what I tried. but the script literally does nothing at all except deselect any selected tracks.

                                                  1. Ben Rubin @Ben_Rubin
                                                      2023-02-26 01:40:14.613Z

                                                      also found this error in the log:
                                                      Could not get UIElement for AxPtTrackOutputPathButton: Could not find Audio Output Path selector button

                                                      did not flash an error message

                                                      1. samuel henriques @samuel_henriques
                                                          2023-03-02 17:43:06.199Z

                                                          Hello Ben
                                                          Sorry I'm taking so long to reply. I can't reproduce this error. could you make a screen capture of the script working please? Maybe I can figure something out.

                                                          Thank you

                                                          1. Ben Rubin @Ben_Rubin
                                                              2023-03-03 16:24:04.862Z

                                                              thanks as always. i wish i could but id just be taking a video of literally nothing happening. does that help at all?

                                                              1. samuel henriques @samuel_henriques
                                                                  2023-03-03 16:38:43.613Z

                                                                  Hello Ben,
                                                                  Please copy paste again the script, just in case. And double check that the output names are actually being used in any track. Also, it'll only work on visible tracks.
                                                                  Confirm if the blue SF symbol blinks blue when you trigger the script and then you get any error.
                                                                  If still it's not working, even if nothing seams to happen, make the video, you never know if theres any clue. And before you run it, clear the log, run, and send me the log.

                                                                  Sorry its taking so long.

                                                                  1. Ddanielkassulke @danielkassulke
                                                                      2024-01-07 05:51:26.214Z

                                                                      Hi @samuel_henriques

                                                                      Just chiming in on this incredible script - at some point in the last few months this script has stopped working, as Ben Rubin described.

                                                                      I'm certain of the following:

                                                                      • Output names are exact, and in use
                                                                      • Desired tracks are visible
                                                                      • SF symbol blinks blue, with no error

                                                                      Here's the log:

                                                                      07.01.2024 15:44:47.16 [EditorWindow:Renderer]: Active Focus Container: code Line 33963 file:///Applications/SoundFlow.app/Contents/Helpers/SoundFlow.app/Contents/Resources/app.asar/dist/editor.js
                                                                      07.01.2024 15:44:48.42 [EditorWindow:Renderer]: FocusContainer code lost focus to child: [object HTMLButtonElement]. target=[object HTMLDivElement] Line 115083 file:///Applications/SoundFlow.app/Contents/Helpers/SoundFlow.app/Contents/Resources/app.asar/dist/editor.js
                                                                      07.01.2024 15:44:48.43 [EditorWindow:Renderer]: Active Focus Container: code Line 33963 file:///Applications/SoundFlow.app/Contents/Helpers/SoundFlow.app/Contents/Resources/app.asar/dist/editor.js
                                                                      07.01.2024 15:44:48.51 [EditorWindow:Renderer]: Calling backendwebclient sendasync: /commands/run [object Object] Line 56463 file:///Applications/SoundFlow.app/Contents/Helpers/SoundFlow.app/Contents/Resources/app.asar/dist/editor.js
                                                                      07.01.2024 15:44:48.51 [Backend]: Received run command: user:clabwdfty000mvt106k2lb09j:cllmtjtvu000wb010pof174vg
                                                                      [ServerController] Running command from sfgui: 'PT Select By Output' (user:clabwdfty000mvt106k2lb09j:cllmtjtvu000wb010pof174vg)

                                                                      07.01.2024 15:44:48.51 [Backend]: >> Command: PT Select By Output [user:clabwdfty000mvt106k2lb09j:cllmtjtvu000wb010pof174vg]

                                                                      07.01.2024 15:44:48.51 [Backend]: [NSRunningApplication (static)] Checking for running apps with bundle 'com.avid.ProTools'

                                                                      07.01.2024 15:44:48.51 [Backend]: NSArray.ArrayFromHandle count = 1

                                                                      07.01.2024 15:44:48.51 [Backend]: #App: Activate "com.avid.ProTools" -> 2023.11 DECK [clavouz780000sh10ocrwjss8]

                                                                      07.01.2024 15:44:48.52 [StartMenu]: StartMenuContainer currentPageKey='home' Line 24630 file:///Applications/SoundFlow.app/Contents/Helpers/SoundFlow.app/Contents/Resources/app.asar//dist/bundle.js
                                                                      07.01.2024 15:44:48.60 [Backend]: Mouse current pos is: (741.71875, 359.6640625)
                                                                      Clicking with mouse here: (11, 73)

                                                                      07.01.2024 15:44:48.61 [Backend]: Moving mouse back to: (741.71875, 359.6640625)

                                                                      07.01.2024 15:44:48.61 [Backend]: Position is now: (741.71875, 359.6640625)

                                                                      07.01.2024 15:44:48.65 [Backend]: << Command: PT Select By Output [user:clabwdfty000mvt106k2lb09j:cllmtjtvu000wb010pof174vg]

                                                                      07.01.2024 15:44:48.65 [Backend]: Logging error in action (01) DeckOpenAction: The specified device wasn't found

                                                                      07.01.2024 15:44:48.65 [StartMenu]: StartMenuContainer currentPageKey='home' Line 24630 file:///Applications/SoundFlow.app/Contents/Helpers/SoundFlow.app/Contents/Resources/app.asar//dist/bundle.js
                                                                      07.01.2024 15:44:55.67 [Backend]: [SF_FIREBASE_WS]: Sending keep-alive

                                                                      07.01.2024 15:45:37.36 [Backend]: #App: Activate "com.avid.ProTools" -> 2023.11 DECK [clavouz780000sh10ocrwjss8]

                                                                      07.01.2024 15:45:37.36 [Backend]: Logging error in action (01) DeckOpenAction: The specified device wasn't found

                                                                      And a link to a screen recording: https://www.dropbox.com/scl/fi/0oo6tbeyw5vwux1ie0epf/Select-Track-By-Output.mov?rlkey=050plek3q3fhmpbih6m49jsxg&dl=0

                                          2. S
                                            In reply toPhilip_weinrobe:
                                            Sreejesh Nair @Sreejesh_Nair
                                              2024-01-08 16:14:00.302Z

                                              Here is a code you can try. It will list out all the used IO on your tracks and you can then select (multi select with shift) in the list and it will select all those tracks for you.

                                              sf.ui.proTools.appActivateMainWindow();
                                              sf.ui.proTools.menuClick({
                                                  menuPath: ['View', 'Edit Window Views', 'I/O'],
                                                  targetValue: "Enable",
                                                  onError: "Continue",
                                              });
                                              
                                              const outputsSet = new Set();
                                              const visibleTracks = sf.ui.proTools.visibleTrackHeaders;
                                              
                                              visibleTracks.forEach(track => {
                                                  let outputPathBtn = track.outputPathButton;
                                                  if (outputPathBtn.exists) {
                                                      let outputNames = outputPathBtn.title.invalidate().value.split("\n");
                                                      outputNames.forEach(name => outputsSet.add(name));
                                                  }
                                              });
                                              
                                              const outputsArray = Array.from(outputsSet);
                                              
                                              const selectedOutputs = sf.interaction.selectFromList({
                                                  title: "Select Outputs",
                                                  allowMultipleSelections: true,
                                                  items: outputsArray
                                              }).list;
                                              
                                              if (!selectedOutputs || selectedOutputs.length === 0) {
                                                  throw 0;
                                              }
                                              
                                              const trackNamesToSelect = [];
                                              
                                              visibleTracks.forEach(track => {
                                                  let outputPathBtn = track.outputPathButton;
                                                  if (outputPathBtn.exists) {
                                                      let pathAssignmentNames = outputPathBtn.title.invalidate().value.split("\n");
                                              
                                                      let foundSelectedOutput = pathAssignmentNames.some(assignmentName =>
                                                          selectedOutputs.includes(assignmentName)
                                                      );
                                              
                                                      if (foundSelectedOutput) {
                                                          trackNamesToSelect.push(track.normalizedTrackName);
                                                      }
                                                  }
                                              });
                                              
                                              if (trackNamesToSelect.length > 0) {
                                                  sf.ui.proTools.trackSelectByName({ names: trackNamesToSelect });
                                                  sf.ui.proTools.selectedTrack.trackScrollToView();
                                              } else {
                                                  alert("No tracks were found with the selected outputs.")
                                              }
                                              
                                              1. Ben Rubin @Ben_Rubin
                                                  2025-03-19 04:00:59.474Z

                                                  hey @Sreejesh_Nair, thanks for posting this, works great.