Strip Silence Script
Hi All!
Andrew Scheps helped me script out some automation for Strip Silence (by helped, I mean he took my cave man script and brought it to life!)
It has a few things that could be improved upon, but thought we would share. You'll want to enter your strip silence settings before running the script, but this will strip silence from selected tracks, both adjacent and non. I love this one!
// NOTE: Setup Strip Silence with your preferred settings before running this script
function stripTheSilence(trackHeader) {
//Select track
trackHeader.trackSelect();
//Scroll track into View
trackHeader.trackScrollToView();
// Select All Clips In Track
sf.keyboard.press({
keys: 'cmd+a'
});
// Click Strip Button
sf.ui.proTools.windows.whoseTitle.is("Strip Silence").first.buttons.whoseTitle.is("Strip").first.mouseClickElement();
// Create Fades On Clips
sf.keyboard.press({
keys: 'f'
});
}
function main() {
// Set Pro Tools frontmost
sf.ui.proTools.appActivateMainWindow();
//Get selected tracks
const selectedTrackHeaders = sf.ui.proTools.selectedTracks.trackHeaders;
// Declare stripSilenceWin Variable as Strip Silence Window
var stripSilenceWin = sf.ui.proTools.windows.whoseTitle.is("Strip Silence").first;
if (stripSilenceWin && stripSilenceWin.exists) {
//Strip Silence IS open, do nothing
} else {
//Strip Silence is NOT open
// Open Strip Silence
sf.ui.proTools.menuClick({
menuPath: ['Edit', 'Strip Silence']
});
// stripSilenceWin.getElement("AXTitleUIElement").elementWaitFor();
}
selectedTrackHeaders.forEach( trackHeader => {
stripTheSilence(trackHeader)
});
// Close Strip Silence
sf.ui.proTools.viewCloseFocusedFloatingWindow();
}
main();
- MMark Abrams @Mark_Abrams
Sorry, looks like I copied it in wrong. It's my first day :)
Kitch Membery @Kitch2021-06-05 19:41:19.679Z
Hi @Mark_Abrams,
Thanks for sharing :-). I fixed the formatting for you.
Please check this tutorial for how to quote code in the SoundFlow forum, so that it displays in a readable format:
Rock on
Kitch- MMark Abrams @Mark_Abrams
Thanks Kitch! Will do!
- PIn reply toMark_Abrams⬆:Philip weinrobe @Philip_weinrobe
is anybody smart enough to modify this script so that when it ends it re-selects the originally selected tracks?
Ryan DeRemer @Ryan_DeRemer
@Philip_weinrobe Try this:
// NOTE: Setup Strip Silence with your preferred settings before running this script function stripTheSilence(trackHeader) { //Select track trackHeader.trackSelect(); //Scroll track into View trackHeader.trackScrollToView(); // Select All Clips In Track sf.keyboard.press({ keys: 'cmd+a' }); // Click Strip Button sf.ui.proTools.windows.whoseTitle.is("Strip Silence").first.buttons.whoseTitle.is("Strip").first.mouseClickElement(); } function main() { // Set Pro Tools frontmost sf.ui.proTools.appActivateMainWindow(); //Get selected tracks const selectedTrackHeaders = sf.ui.proTools.selectedTracks.trackHeaders; const origSelectedTracks = sf.ui.proTools.selectedTrackNames // Declare stripSilenceWin Variable as Strip Silence Window var stripSilenceWin = sf.ui.proTools.windows.whoseTitle.is("Strip Silence").first; if (stripSilenceWin && stripSilenceWin.exists) { //Strip Silence IS open, do nothing } else { //Strip Silence is NOT open // Open Strip Silence sf.ui.proTools.menuClick({ menuPath: ['Edit', 'Strip Silence'] }); // stripSilenceWin.getElement("AXTitleUIElement").elementWaitFor(); } selectedTrackHeaders.forEach( trackHeader => { stripTheSilence(trackHeader) }); // Close Strip Silence sf.ui.proTools.viewCloseFocusedFloatingWindow(); // Re-select original tracks sf.ui.proTools.trackSelectByName({ names: origSelectedTracks }); } main();