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 });
- samuel henriques @samuel_henriques
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",
insf.ui.proTools.menuClick({ menuPath: ["Edit", "Strip Silence"], targetValue: "Toggle", });
Let me know if this helped.
Brandon Metcalf @Brandon_Metcalf
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!
- OIn reply toBrandon_Metcalf⬆:Owen Granich-Young @Owen_Granich_Young
Thanks for clear searchable topic! Solved a problem for me too!