No internet connection
  1. Home
  2. Macro and Script Help

AUTO-Prep (Pro Tools Flex - May 2022)

By Vic Cuccia @viccucciamusic
    2022-05-18 22:48:10.325Z

    Title

    AUTO-Prep (Pro Tools Flex - May 2022)

    What do you expect to happen when you run the script/macro?

    It's supposed to:

    1. Select all audio tracks inside a Folder track
    2. Route the output of these audio tracks to the corresponding input of the Folder track
    3. Move on to the next available Folder track and repeat the process

    Are you seeing an error?

    Cannot read property "title button" of null Selected audio tracks in current FOLDER line 6

    What happens when you run this script?

    It fails when moving on to repeat the action

    How were you running this script?

    I used a Stream Deck button

    How important is this issue to you?

    5

    Details

    {
        "inputExpected": "It's supposed to:\n\n1. Select all audio tracks inside a Folder track\n2. Route the output of these audio tracks to the corresponding input of the Folder track\n3. Move on to the next available Folder track and repeat the process",
        "inputIsError": true,
        "inputError": "Cannot read property \"title button\" of null\nSelected audio tracks in current FOLDER line 6",
        "inputWhatHappens": "It fails when moving on to repeat the action",
        "inputHowRun": {
            "key": "-MpfwmPg-2Sb-HxHQAff",
            "title": "I used a Stream Deck button"
        },
        "inputImportance": 5,
        "inputTitle": "AUTO-Prep (Pro Tools Flex - May 2022)"
    }

    Source

    //Macro converted to script
    
    
    //Calling command "Zoom Out All Tracks" from package "undefined" (installed from user/pkg/version "srAasovvDiQacRZ2mcId4RrOA8R2/ckp49i4j60000a2100yfwywgf/ckyu15xww00004v10dq15rpgq")
    sf.soundflow.runCommand({
        commandId: 'user:ckp49i4j60000a2100yfwywgf:ckwvtpw1a0000ur10w02ndlps#ckwvtxwwq0003ur10p4ahv4l1',
        props: {}
    });
    
    sf.keyboard.press({
        keys: "ctrl+cmd+alt+up, ctrl+alt+up",
    });
    
    sf.ui.proTools.trackEnsureTrackListViewIsAccessible({
        makeVisible: true,
    });
    
    /* //Calling command "Show Only Audio Tracks" from package "M1"
    sf.soundflow.runCommand({
        commandId: 'package:cl1vi47ig001tgo101mxo4ti1',
        props: {}
    }); */
    
    //Calling command "Hide Inactive Tracks" from package "M1"
    sf.soundflow.runCommand({
        commandId: 'package:cl1wmma2r00056310lmndv0zs',
        props: {}
    });
    
    /* sf.keyboard.press({
        keys: "home",
    }); */
    
    /* //Calling command "Select Audio Tracks in Current FOLDER" from package "VIC Session Prep 2021.6"
    sf.soundflow.runCommand({
        commandId: 'user:ckq73n75k00009j104g4z1f37:ckq75vumk001k9j10ymcdkc2x',
        props: {}
    }); */
    
    /* //Calling command "Set output of selected tracks to Input of Folder Track (May 2022)" from package "M1"
    sf.soundflow.runCommand({
        commandId: 'user:cl1vepph00001go10iphk56xj:cl37w9hiv00027n1061qz1856',
        props: {}
    }); */
    
    /* sf.keyboard.press({
        keys: "semicolon",
    }); */
    
    //Calling command "Repeat N Times" from package "undefined" (installed from user/pkg/version "srAasovvDiQacRZ2mcId4RrOA8R2/ckuxffxq80000u010m7g02u3l/ckykkhblv00005010vnzhi0gm")
    sf.soundflow.runCommand({
        commandId: 'user:ckuxffxq80000u010m7g02u3l:ckuxg4i32000cu010dk8ldgm3',
        props: {
            repetitions: 3,
        }
    });
    
    
    

    Links

    User UID: ts9UvupFaLPwJESD715UM7Fll4I2

    Feedback Key: sffeedback:ts9UvupFaLPwJESD715UM7Fll4I2:-N2OLr1iaWfXwtyTiO6A

    Feedback ZIP

    • 14 replies
    1. Vic Cuccia @viccucciamusic
        2022-05-18 22:49:34.339Z

        Hi there friends! Attaching the error here so we can hopefully continue to move forward with this Macro. Feel free to let me know any questions you may have, but it's a continuation of the following:

        Best,

        • Vic Cuccia
        1. cc @Kitch

          1. In reply toviccucciamusic:
            Kitch Membery @Kitch2022-05-23 21:24:23.588Z

            Hi @viccucciamusic,

            I've not gotten around to revisiting this. Thanks for posting the report.

            I'll take a look in the next couple of days.

            1. Vic Cuccia @viccucciamusic
                2022-05-23 21:43:36.771Z

                All good, thanks for touching base bud. Looking forward to it!

            2. In reply toviccucciamusic:
              Kitch Membery @Kitch2022-05-24 23:37:15.184Z

              Hi @viccucciamusic,

              In the last thread, I posted asking for you to test the single script that you were having issues with (Assigning selected tracks outputs to the input of their parent Routing Folder). This thread, however, seems to be for a macro containing links to multiple scripts. As I mentioned It's important to be able to isolate the issue so let's try and focus on the script from the previous thread.

              See here: Audio Track outputs NOT assigining to Folder Track Input #post-31

              Could you follow these steps carefully so that I can get the information I need to investigate the issue.

              • Create a new Script and name it "Route Selected Tracks to Parent Routing Folder" (Or whatever you want to call it.)

              • Paste the following code into the new script.

              function getPreviousFolderTrack(trackName) {
                  const track = sf.ui.proTools.trackGetByName({ name: trackName }).track;
              
                  const trackType = track.title.invalidate().value.split(" - ").pop().trim();
                  const inputPath = track.inputPathButton.title.invalidate().value.split("\n").pop().slice(1, -1);
              
                  return {
                      trackName,
                      trackType,
                      inputPath,
                  }
              }
              
              function main() {
                  sf.ui.proTools.appActivateMainWindow();
              
                  const visibleTrackNames = sf.ui.proTools.visibleTracks.names;
                  const selectedTrackName = sf.ui.proTools.selectedTrack.normalizedTrackName;
              
                  const priorTracks = visibleTrackNames.slice(0, visibleTrackNames.indexOf(selectedTrackName));
                  const priorRoutingFolderTrack = priorTracks.map(getPreviousFolderTrack).filter(tn => tn.trackType === "Routing Folder Track").pop();
              
                  const folderInput = priorRoutingFolderTrack.inputPath;
              
                  sf.ui.proTools.selectedTrack.trackOutputSelect({
                      outputSelector: items => items.filter(p => p.path[1] && p.path[1].split("(").slice(0, 1).join("(").trim() === folderInput)[0],
                      selectForAllSelectedTracks: true
                  });
              }
              
              main();
              
              • Select a single track or multiple tracks inside a "Routing Folder" in Pro Tools.

              • Run the script.

              • If the script does not reassign the selected tracks to the Input of the parent "Routing Folder" track, please follow the Script Help (bit.ly/sfscripthelp) steps on the newly created script. Also as mentioned in the last post, It would be great if you could take a screen recording so I can better understand where the issue is occurring. Be sure to tag me @kitch in the newly created post should the script fail.

              • If the new script works, we can then reevaluate any other issue that may be occurring where the issue is in the macro.

              Thanks in advance Vic.

              1. In reply toviccucciamusic:
                Kitch Membery @Kitch2022-05-25 00:52:23.871Z

                Hi again @viccucciamusic,

                So... I did a little extra digging, as I know you've been wanting a fix for this for a while. And I noticed that if any track above the Select track(s) has no input button, the script would fail, so here is an update that should rectify that.

                function getPreviousFolderTrack(trackName) {
                    const track = sf.ui.proTools.trackGetByName({ name: trackName }).track;
                
                    let trackInfo = {};
                
                    if (track.inputPathButton.exists) {
                        const trackType = track.title.invalidate().value.split(" - ").pop().trim();
                        const inputPath = track.inputPathButton.title.invalidate().value.split("\n").pop().slice(1, -1);
                
                        trackInfo = {
                            trackName,
                            trackType,
                            inputPath,
                        }
                    }
                
                    return trackInfo;
                }
                
                function main() {
                    sf.ui.proTools.appActivateMainWindow();
                    sf.ui.proTools.mainWindow.invalidate();
                
                    const visibleTrackNames = sf.ui.proTools.visibleTracks.names;
                    const selectedTrackName = sf.ui.proTools.selectedTrack.normalizedTrackName;
                
                    const priorTracks = visibleTrackNames.slice(0, visibleTrackNames.indexOf(selectedTrackName));
                    const priorRoutingFolderTrack = priorTracks.map(getPreviousFolderTrack).filter(tn => tn.trackType === "Routing Folder Track").pop();
                
                    if (priorRoutingFolderTrack !== undefined) {
                        const folderInput = priorRoutingFolderTrack.inputPath;
                
                        sf.ui.proTools.selectedTrack.trackOutputSelect({
                            outputSelector: items => items.filter(p => p.path[1] && p.path[1].split("(").slice(0, 1).join("(").trim() === folderInput)[0],
                            selectForAllSelectedTracks: true,
                        });
                    } else {
                        log(`There are no "Routing Folders" available above the selected track`);
                    }
                }
                
                main();
                

                Hopefully that does the trick :-)

                Rock on!

                1. Vic Cuccia @viccucciamusic
                    2022-05-25 15:41:44.999Z

                    Right on bud, truly appreciate the time & effort towards this script! I'll test it out and let you know as soon as possible 🤘

                    1. Vic Cuccia @viccucciamusic
                        2022-05-25 21:55:11.853Z

                        Hey man no luck. This is the message I'm getting:

                        1. Vic Cuccia @viccucciamusic
                            2022-05-25 21:55:37.304Z

                            I tested both the first and second ones btw 👍

                            1. Kitch Membery @Kitch2022-05-26 00:27:43.929Z

                              Hi @viccucciamusic,

                              Ok next step, please select the 2nd version of the script and then follow the steps laid out in - Post 6 : AUTO-Prep (Pro Tools Flex - May 2022) #post-6

                              Also, be sure to provide a screen recording so I can get the information I need to do further troubleshooting.

                              1. Vic Cuccia @viccucciamusic
                                  2022-05-26 04:25:14.293Z

                                  Got it, will do Kitch! My apologies for overlooking the steps below the script, was so excited to try that it went right over my head.

                          • In reply toKitch:
                            JJack Byrne @Jack_Byrne
                              2022-09-26 09:43:32.599Z

                              Just wanted to chime in and say this is excellent, and a much neater solution to part of my prep than I was thinking of

                              1. Vic Cuccia @viccucciamusic
                                  2022-09-28 19:06:12.015Z

                                  Happy to hear, Jack! Still refining it, hopefully official version will be out soon (:

                                  1. Vic Cuccia @viccucciamusic
                                      2022-09-28 19:07:32.818Z

                                      @Kitch what's a good day to meet up and chat about this?