No internet connection
  1. Home
  2. How to

Error: "Selected track header and track list item does not match"

By Brandon Metcalf @Brandon_Metcalf
    2021-07-07 20:06:32.945Z

    Hi! I'm trying to figure out what it causing a silly error that is happening intermittently.

    I used a script from the forum as a starting point for running a process on all selected tracks. Sometimes it works perfectly, and other times it throws the error: "Selected track header and track list item does not match"

    Example below - this is one I use to run Strip Silence across multiple tracks. Is there a cleaner or more efficient way for me to write this script?

    Thanks!

    
    //Activate Pro Tools
    sf.ui.proTools.appActivate();
    
    //Get selected tracks
    const originalTracks = sf.ui.proTools.selectedTrackNames;
    
    //Do for each track.
    sf.ui.proTools.selectedTracks.trackHeaders.slice().map(track => {
    
        //Select track
        track.trackSelect();
    
        //Scroll track into View
        track.trackScrollToView();
    
        //Do Stuff Here
    sf.ui.proTools.menuClick({
        menuPath: ["Edit","Select All"],
    });
    
    sf.ui.proTools.menuClick({
        menuPath: ["Edit","Strip Silence"],
        targetValue: "Toggle",
    });
    
    sf.ui.proTools.windows.whoseTitle.is("Strip Silence").first.buttons.whoseTitle.is("Strip").first.elementClick();
    
    sf.ui.proTools.windows.whoseTitle.is("Strip Silence").first.getElement("AXCloseButton").elementClick();
    
    sf.ui.proTools.windows.whoseTitle.is("Strip Silence").first.getElement("AXTitleUIElement").elementWaitFor({
        waitType: "Disappear",
    });
    
    });
    
    //Restore previously selected tracks
    sf.ui.proTools.trackSelectByName({ names: originalTracks });
    
    Solved in post #2, click to view
    • 3 replies
    1. samuel henriques @samuel_henriques
        2021-07-07 21:32:34.367Z

        Hello @Brandon_Metcalf,

        I managed to replicate your error if I rename a track, and it probably happens as well if you add or delete tracks from the session.

        Just add sf.ui.proTools.invalidate() to the start of the script and you should be fine. This will get lots of important information from the session into soundFlow, like track names, track list, elements, etc...

        //Activate Pro Tools
        sf.ui.proTools.appActivate();
        sf.ui.proTools.invalidate()
        

        Also, you don't need the targetValue: "Toggle",in

           sf.ui.proTools.menuClick({
                menuPath: ["Edit", "Strip Silence"],
                targetValue: "Toggle",
            });
        

        Let me know if this helped.

        Reply2 LikesSolution
        1. Brandon Metcalf @Brandon_Metcalf
            2021-07-07 23:34:18.072Z

            amazing man! thank you so much for taking time to jump in and help out. first test on tracks that were previously throwing the error works like a charm!

          • O
            In reply toBrandon_Metcalf:

            Thanks for clear searchable topic! Solved a problem for me too!