No internet connection
  1. Home
  2. How to

Selected Track (s) output & Color to the respective routing folder

By Vic Cuccia @viccucciamusic
    2021-06-21 22:28:32.052Z

    Hi there,

    I was wondering if there's a script which would automatically assign the Output and Color of tracks inside a routing folder to the same color, and correct input of that respective folder?

    My goal with this macro is so when I'm prepping a session I can just drag the audio tracks into the correct routing folders (pre-existed in my template), and then run a script which would route all those audio tracks correctly in accordance with which routing folders they are in.

    Thanks in advance!

    Vic

    • 27 replies

    There are 27 replies. Estimated reading time: 18 minutes

    1. You could create a track preset for each folder in your template that recalls the track color and routing for the tracks and then create a macro / script for each preset.

      So if you have a folder called DRUMS in your template that's blue, you could create a DRUMS preset that just recalls the routing to that folder and the color. Make one for each folder then write a macro/script that recalls each preset.

      This would be the simplest way to do it.

      1. Vic Cuccia @viccucciamusic
          2021-06-21 23:33:12.580Z

          Hey Chris,

          I've been using this way however the "track preset" function ends up being quite buggy, and quite laggy to be honest, hence why I don't want to rely on recalling track presets.

        • In reply toviccucciamusic:

          Hey Vic! I just recently updated my utilities package with a command that will do most of what you're looking for. It's called "Move to Existing Folder" and it has the option to also route the selected tracks to a folder's input.

          What I suggest you do is create a macro that looks like this for every folder in your template:

          First, use the SoundFlow command "Set Track/Clip Color" to set the color of the selected tracks. Then use my Move to Existing Folder command to move and route them to the desired folder.

          Hope that helps!

          1. Vic Cuccia @viccucciamusic
              2021-06-21 23:34:12.350Z

              Hey Raphael,

              Cool set of macros man, I'll give this one a shot. It's a bit different than what I'm trying to do but could work as well.

              Thanks,

              • Vic
            • A
              In reply toviccucciamusic:
              Andrew Downes @Andrew_Downes
                2021-06-22 00:15:36.469Z
                1. Vic Cuccia @viccucciamusic
                    2021-06-22 03:37:26.392Z

                    Appreciate your reply, Andrew! Unfortunately it’s not. As described above, I want to work with pre-set routing folders within my mix template. In other words, I’m trying to have a script which automatically identifies what routing folder the selected audio tracks are in and assigns the correct output/color to those tracks.

                  • In reply toviccucciamusic:

                    Getting a track or Folder's color is not an easy thing to do but this script will assign the output of a folder's tracks to its input.

                    I haven't throughly tested it but it seems to work.

                    sf.ui.proTools.appActivate();
                    const app = sf.ui.proTools
                    
                    function getTrackType(trackName) {
                        var trackInfo = sf.ui.proTools.trackGetByName({ name: trackName }).track;
                        var trackTypeValue = trackInfo.title.value
                        return trackTypeValue.slice(trackTypeValue.lastIndexOf(" - ") + 3, trackTypeValue.length).trim();
                    };
                    
                    // Get selected tracks
                    var originalSelectedTracks = app.selectedTrackNames;
                    
                    // Keep moving up one track until a Folder track is selected
                    var trackType = " ";
                    var isTrackFolder = false;
                    
                    while (!isTrackFolder) {
                        sf.keyboard.press({
                            keys: 'p'
                        });
                        var currentTrack = app.selectedTrackNames[0];
                        trackType = getTrackType(currentTrack);
                    
                        if (trackType == "Routing Folder Track") { isTrackFolder = true }
                    };
                    
                    // get Input bus of folder track
                    var folderInput = app.selectedTrack.groups.whoseTitle.is("Audio IO").first.popupButtons.first.value.invalidate().value;
                    
                    // Reselect original selected tracks
                    app.invalidate();
                    app.trackSelectByName({ names: originalSelectedTracks, deselectOthers: true });
                    
                    // Assign original selected track's output to Folder track input
                    app.selectedTrack.groups.whoseTitle.is("Audio IO").whoseTitle.is("Audio IO").first.popupButtons.allItems[1].popupMenuSelect({
                        isShift: true,
                        isOption: true,
                        menuPath: ["search..."],
                    });
                    sf.keyboard.type({
                        text: folderInput,
                    });
                    
                    sf.keyboard.press({ keys: 'return' });
                    
                    
                    
                    1. Vic Cuccia @viccucciamusic
                        2021-06-22 20:39:27.425Z

                        Amazing, Chris, thank you for your time! I feel as though perhaps we got something backwards: it should assign the INPUT of the folder track to the audio tracks inside it (:

                        Let me know if that's an easy fix/doable! And no worries about coloring, I can live without it!

                        Thanks in advance,
                        Vic

                        1. Hmm that's not how the request was worded:

                          assign the Output and Color of tracks inside a routing folder to the same color, and correct input of that respective folder?

                          I'll see if I can change it though. It will use the output of the first selected track in a folder to set the output of the folder.

                          1. Chris Shaw @Chris_Shaw2021-06-22 21:02:27.306Z2021-06-22 21:17:37.691Z

                            Try this:

                            sf.ui.proTools.appActivate();
                            const app = sf.ui.proTools
                            
                            function getTrackType(trackName) {
                                var trackInfo = sf.ui.proTools.trackGetByName({ name: trackName }).track;
                                var trackTypeValue = trackInfo.title.value
                                return trackTypeValue.slice(trackTypeValue.lastIndexOf(" - ") + 3, trackTypeValue.length).trim();
                            };
                            
                            // Get selected tracks
                            var originalSelectedTracks = app.selectedTrackNames;
                            
                            // Get first visible track
                            var firstVisibleTrack = app.visibleTrackNames[0]
                            
                            // Get first track's output
                            var memberOutput = app.selectedTrack.groups.whoseTitle.is("Audio IO").whoseTitle.is("Audio IO").first.popupButtons.allItems[1].value.invalidate().value
                            
                            
                            // keep moving up one track until a Folder track is selected
                            var trackType = " ";
                            var isTrackFolder = false
                            while (!isTrackFolder) {
                                sf.keyboard.press({
                                    keys: 'p'
                                });
                                var currentTrack = app.selectedTrackNames[0];
                                trackType = getTrackType(currentTrack);
                                if (trackType == "Routing Folder Track") { isTrackFolder = true; var folderName = currentTrack };
                                if (currentTrack == firstVisibleTrack) { throw ("You seemed to have selected tracks that are outside of a folder. Try again") };
                            
                            };
                            
                            // get Input bus of folder track
                            var folderInput = app.selectedTrack.groups.whoseTitle.is("Audio IO").first.popupButtons.first.value.invalidate().value;
                            
                            // Reselect original selected tracks
                            app.invalidate();
                            app.trackSelectByName({ names: originalSelectedTracks, deselectOthers: true });
                            
                            // Assign original track's output to Folder track input
                            app.selectedTrack.groups.whoseTitle.is("Audio IO").whoseTitle.is("Audio IO").first.popupButtons.allItems[1].popupMenuSelect({
                                isShift: true,
                                isOption: true,
                                menuPath: ["search..."],
                            });
                            sf.keyboard.type({
                                text: folderInput,
                            });
                            
                            sf.keyboard.press({ keys: 'return' });
                            
                            // select Folder Track and set track Output
                            
                            app.trackSelectByName({ names: [folderName] })
                            
                            app.selectedTrack.groups.whoseTitle.is("Audio IO").whoseTitle.is("Audio IO").first.popupButtons.allItems[1].popupMenuSelect({
                                isShift: true,
                                isOption: true,
                                menuPath: ["search..."],
                            });
                            
                            sf.keyboard.type({
                                text: memberOutput,
                            });
                            
                            sf.wait({ intervalMs: 200 })
                            
                            sf.keyboard.press({ keys: 'return' });
                            
                            1. In reply toChris_Shaw:
                              Vic Cuccia @viccucciamusic
                                2021-06-22 22:29:45.521Z

                                I'd say "assign the output [...] of tracks inside a routing folder to the same [...] correct input of that respective folder" sounds the same to me as "assign the INPUT of the folder track to the audio tracks inside it", meaning the OUTPUT of those audio tracks (which are inside the routing folder) would match the respective routing folder's INPUT. This would then ensure they are routed to that respective routing folder. I know it sounds confusing so no big deal at all (:

                                Perhaps I'm not wording it the best way, as I can see the one you just made is now Output to Output, which would result in the audio tracks NOT being routed to the routing folder.

                                No pressure at all if it's weird to make this work, I can always manually assign each routing folder if needed be.

                                1. The first script assumes that the folder is set up properly before putting anything in it - it has an assigned input and output. So when you throw some tracks into the folder and run the script it will route the output of those tracks to to the input of the folder track.

                                  The second script assumes that you have some tracks who’s output you want to keep but you’d want to process them all via a folder track while retaining the enclosed tracks output (essentially routing the tracks through the folder without changing the destination of the original tracks). So you put the tracks in the folder and the script will route the tracks to the input of the folder and set the output of that folder to the original output of the tracks.

                                  The only other variation left is you want to put some tracks in a folder without changing their routing and use the enclosed tracks’ output as the input to the folder. So the only thing that gets changed is the folder track’s input. Right?

                                  1. sf.ui.proTools.appActivate();
                                    const app = sf.ui.proTools
                                    
                                    function getTrackType(trackName) {
                                        var trackInfo = sf.ui.proTools.trackGetByName({ name: trackName }).track;
                                        var trackTypeValue = trackInfo.title.value
                                        return trackTypeValue.slice(trackTypeValue.lastIndexOf(" - ") + 3, trackTypeValue.length).trim();
                                    };
                                    
                                    // Get selected tracks
                                    var originalSelectedTracks = app.selectedTrackNames;
                                    
                                    // Get first visible track
                                    var firstVisibleTrack = app.visibleTrackNames[0]
                                    
                                    // Get first track's output
                                    var memberOutput = app.selectedTrack.groups.whoseTitle.is("Audio IO").whoseTitle.is("Audio IO").first.popupButtons.allItems[1].value.invalidate().value
                                    
                                    
                                    // keep moving up one track until a Folder track is selected
                                    var trackType = " ";
                                    var isTrackFolder = false
                                    while (!isTrackFolder) {
                                        sf.keyboard.press({
                                            keys: 'p'
                                        });
                                        var currentTrack = app.selectedTrackNames[0];
                                        trackType = getTrackType(currentTrack);
                                        if (trackType == "Routing Folder Track") { isTrackFolder = true; var folderName = currentTrack };
                                        if (currentTrack == firstVisibleTrack) { throw ("You seemed to have selected tracks that are outside of a folder. Try again") };
                                    
                                    };
                                    
                                    
                                    
                                    // Assign folder input to member track's output
                                    app.selectedTrack.groups.whoseTitle.is("Audio IO").whoseTitle.is("Audio IO").first.popupButtons.first.popupMenuSelect({
                                        isShift: true,
                                        isOption: true,
                                        menuPath: ["search..."],
                                    });
                                    sf.keyboard.type({
                                        text: memberOutput,
                                    });
                                    
                                     sf.keyboard.press({ keys: 'return' });
                                    
                                    
                                    1. In reply toChris_Shaw:
                                      Vic Cuccia @viccucciamusic
                                        2021-06-23 21:38:39.977Z

                                        Ah gotcha, perhaps there was some misunderstanding/misexplanation on the first script. I'll most definitely try it out the next couple days and report back to you, Chris. Thanks a ton!!

                                2. In reply toChris_Shaw:
                                  PPhilip weinrobe @Philip_weinrobe
                                    2022-04-30 22:25:16.905Z

                                    this was working until yesterday for me. perhaps a pro tools 2022.4 issue? does this still work on for others?

                                    issue is at reselecting original selected tracks. i'm getting an SF error because the script is failing to reselect the originally selected tracks....

                                    30.04.2022 18:18:21.36 [Backend]: !! Command Error: Selected Tracks Output to Routing Folder Input [user:default:cl1ct39zw00095810u139g41s]:
                                    No track selected (in Track List View)
                                    Consider turning on Link Edit and Track Selection (Selected Tracks Output to Routing Folder Input: Line 66)

                                    1. Be sure that you're running the latest version of SF (5.1.3)
                                      You may need to download and install it manually.
                                      2022.4 changed the way folders are named internally. SF 5.1.0 and above addresses this issue.

                                      1. PPhilip weinrobe @Philip_weinrobe
                                          2022-04-30 22:40:24.967Z

                                          i'm on 5.1.2
                                          gonna update to 5.1.3 to see if it fixes it...will report back

                                          1. In reply toChris_Shaw:
                                            PPhilip weinrobe @Philip_weinrobe
                                              2022-04-30 22:43:46.202Z

                                              same error on 5.1.3
                                              30.04.2022 18:43:12.50 [Backend]: !! Command Error: Selected Tracks Output to Routing Folder Input [user:default:cl1ct39zw00095810u139g41s]:
                                              No track selected (in Track List View)
                                              Consider turning on Link Edit and Track Selection (Selected Tracks Output to Routing Folder Input: Line 66)

                                              1. In reply toChris_Shaw:
                                                Kitch Membery @Kitch2022-05-02 19:52:51.547Z

                                                Hi Chris,

                                                Possible fix for this script here.

                                                Rock on!

                                                1. PPhilip weinrobe @Philip_weinrobe
                                                    2022-05-02 19:55:30.008Z

                                                    this works PERFECT. i'll work this into my larger script now. thanks Kitch!

                                            • In reply toviccucciamusic:

                                              I think the confusion here is defining what changes. Do you want to change the output of the tracks to match the folder input or do you want to change the folder input to match the tracks' output?

                                              1. The first script changes the track outputs, the third script changes the folder input.

                                                1. Vic Cuccia @viccucciamusic
                                                    2021-06-26 00:50:37.218Z

                                                    First script worked BEAUTIFULLY! Thanks a ton, Chris! You're a legend!!

                                                2. In reply toChris_Shaw:
                                                  Vic Cuccia @viccucciamusic
                                                    2021-06-23 21:39:21.634Z

                                                    Exactly. I want to change the OUTPUT of the tracks (inside the folder) to match the folder input as you described (:

                                                    1. In reply toChris_Shaw:
                                                      MMarco Ravelli @Marco_Ravelli
                                                        2022-01-28 16:37:26.638Z

                                                        Hello everyone! Sorry I know this is an old thread... I am trying to do the same thing, but the first script you posted is not working for me... I'm sorry I'm not at all an expert, do you have any idea of what the problem could be? Thank you very very much in advance :) :)

                                                        1. If you look through the thread I made updates later on. Try the third script