Clear Muted Clips From Selected Track
This is basically a translation of my AppleScript I wrote years ago, incl. some fixes. Thx a ton to @chrscheuer
Note: It works fine but doesn't catch muted clips with sync points, thus it will be improved very soon!
// This script clears all muted clips from the currently selected track
// It includes code from Oliver Momm, Christian Scheuer
// Note: This version doesn't catch clips with sync points, it will be improved though
// Check if track is selected
if (!sf.ui.proTools.getMenuItem('Track', 'Make Inactive').isEnabled) {
return;
}
else {
// "Return" key to go to start of session
sf.keyboard.press({
keys: 'return'
});
// Select first clip
sf.keyboard.press({
keys: 'shift+tab'
});
// Repeat while audio is still selected
while (sf.ui.proTools.getMenuItem('Clip', 'Group').isEnabled) {
var clipIsMuted = sf.ui.proTools.hasMenuItem('Edit', 'Unmute Clips');
var clipIsUnmuted = sf.ui.proTools.hasMenuItem('Edit', 'Mute Clips');
var noClips = sf.ui.proTools.hasMenuItem('Edit', 'Mute');
if (clipIsMuted) {
// Clip is muted
// Delete clip
sf.ui.proTools.menuClick({ menuPath: ['Edit', 'Clear'] });
}
else if (clipIsUnmuted || noClips) {
// Skip clip
sf.keyboard.press({
keys: 'tab'
});
}
// Select next clip
sf.keyboard.press({
keys: 'shift+tab'
});
}
log('Clear Muted Clips', 'All muted clips cleared from this track');
}
// Go to start of session
sf.keyboard.press({
keys: 'return'
});
- SSean @SeanH
this is awesome and thank you for sharing!
would it be possible to tweak this so you could do it "within current selection" rather then on the whole session? just curious.
- ?@anon6770933309
I wouldn't have a quick solution for this particular script version but like I mentioned, this script will be improved anyway as Christian added some cool new functions to SF.
Unfortunately the new script still needs some debugging. When this is done I can think of alternative versions, e.g. for current selection, or all tracks in a session etc. 😉
- DIn reply toanon6770933309⬆:Davide Favargiotti @dieffe
Nice.
Thank you for sharing. I'm thinking to have a another script that move the muted clips to a specific track. I'll give it a try now and will post it here - DIn reply toanon6770933309⬆:Davide Favargiotti @dieffe
The only "issue" I found so far is that some muted clips with in and out fades are deleted but a tiny clip is left in place of the fade in
- ?@anon6770933309
There was an extra step in my original AppleScript but I couldn't remember what it was good for and decided to get rid of it.
Can you send me a short sample session, with silence as audio and some fades?- ?@anon6770933309
I think I fixed it. I want to try it on one of your sessions though.
- DDavide Favargiotti @dieffe
how can I send it? is FB ok for you?
- ?@anon6770933309
Sure.
- In reply todieffe⬆:?@anon6770933309
I haven't received a session from you. So, I take it you fixed it yourself. 😉
- ?@anon6770933309
Looks like it took half a day to show up on FB. I left a msg over there.
- In reply todieffe⬆:?@anon6770933309
Thx a lot for catching this, Davide.
Like I suspected, it was that missing step that I did not translate from my AppleScript which takes care of it.
This should work now and catch fade ins.:// This script clears all muted clips from the currently selected track // It includes code from Oliver Momm, Christian Scheuer // Note: This version doesn't catch clips with sync points, it will be improved though // Check if track is selected if (!sf.ui.proTools.getMenuItem('Track', 'Make Inactive').isEnabled) { return; } else { // "Return" key to go to start of session sf.keyboard.press({ keys: 'return' }); // Select first clip sf.keyboard.press({ keys: 'shift+tab' }); // Repeat while audio is still selected while (sf.ui.proTools.getMenuItem('Clip', 'Group').isEnabled) { var clipIsMuted = sf.ui.proTools.hasMenuItem('Edit', 'Unmute Clips'); var clipIsUnmuted = sf.ui.proTools.hasMenuItem('Edit', 'Mute Clips'); var noClips = sf.ui.proTools.hasMenuItem('Edit', 'Mute'); if (clipIsMuted) { // Clip is muted // Delete clip sf.ui.proTools.menuClick({ menuPath: ['Edit', 'Clear'] }); // "Option+Shift+Tab" keys to extend selection to previous Clip-boundary sf.keyboard.press({ keys: 'alt+shift+tab' }); } else if (clipIsUnmuted || noClips) { // Skip clip sf.keyboard.press({ keys: 'tab' }); } // Select next clip sf.keyboard.press({ keys: 'shift+tab' }); } log('Clear Muted Clips', 'All muted clips cleared from this track'); } // Go to start of session sf.keyboard.press({ keys: 'return' });
- DDavide Favargiotti @dieffe
Thanks Oli, tried the new version and it works as expected! Awesome!
- Jjames hynes @james_hynes
.
- In reply toanon6770933309⬆:Nnick krill @nick_krill
Wow this is super helpful! Thanks so much for sharing this.
In case anyone is interested, I added this little nugget to the beginning of the script to check and disable tab-to-transient before it runs
if (sf.ui.proTools.getMenuItem('Options', 'Tab to Transient').isMenuChecked) { //Tab to Transient is enabled - disable it sf.ui.proTools.menuClick({ menuPath: ["Options","Tab to Transient"], }); } else { //Tab to Transient is not enabled - good! };
This code was just pinched from an old Andrew Scheps bounce script :-)
-nick
- DIn reply toanon6770933309⬆:Davide Favargiotti @dieffe
This is my modified version that moves the muted clips to a new track (created by the script).
// This script moves all muted clips from the currently selected track to a new track, named as the original with the suffix _MUTED_CLIPS // It includes code from Oliver Momm, Christian Scheuer // Note: This version doesn't catch clips with sync points, it will be improved though // Also it doesn't mantain fades in the moved clips. You may have to run it twice to remove all the little regions created from the muted fades. var origTrackName = sf.ui.proTools.selectedTrack.normalizedTrackName; var mutedTrackName = origTrackName + '_MUTED_CLIPS'; // Check if the destination track already exist if (sf.ui.proTools.trackGetByName({ name: mutedTrackName, makeVisible: false }).track) { log('Destination track already exist', 'Moving the muted clips to '+ mutedTrackName); } else{ sf.ui.proTools.trackDuplicateSelected({duplicateActivePlaylist: false}); sf.ui.proTools.selectedTrack.trackRename({newName: mutedTrackName}); sf.ui.proTools.trackSelectByName({names: [origTrackName]}); } // Check if track is selected if (!sf.ui.proTools.getMenuItem('Track', 'Make Inactive').isEnabled) { return; } else { // "Return" key to go to start of session sf.keyboard.press({ keys: 'return' }); // Select first clip sf.keyboard.press({ keys: 'shift+tab' }); // Repeat while audio is still selected while (sf.ui.proTools.getMenuItem('Clip', 'Group').isEnabled) { var clipIsMuted = sf.ui.proTools.hasMenuItem('Edit', 'Unmute Clips'); var clipIsUnmuted = sf.ui.proTools.hasMenuItem('Edit', 'Mute Clips'); var noClips = sf.ui.proTools.hasMenuItem('Edit', 'Mute'); if (clipIsMuted) { // Clip is muted // Move the clip to the destination track. Change 'Cut' to 'Copy' if you want to copy the muted clips sf.ui.proTools.menuClick({ menuPath: ['Edit', 'Cut'] }); sf.ui.proTools.trackSelectByName({names: [mutedTrackName]}); sf.ui.proTools.menuClick({ menuPath: ['Edit', 'Paste'] }); sf.keyboard.press({keys: 'tab'}); sf.ui.proTools.trackSelectByName({names: [origTrackName]}); } else if (clipIsUnmuted || noClips) { // Skip clip sf.keyboard.press({ keys: 'tab' }); } // Select next clip sf.keyboard.press({ keys: 'shift+tab' }); } log('Moved Muted Clips', 'All muted clips moved to '+ mutedTrackName); } // Go to start of session sf.keyboard.press({ keys: 'return' });
note that you may ned to run the script twice to remove some muted clips that remain on the source track (the fades in of the muted clips)
- AAnne Jimkes @Anne_Jimkes
Hey!
Thanks for this great script.
The only issue I had when trying to use it, was that it didn't actually move the muted clips to the newly created track. In order to fix that I actually added a "move playhead to track below" (;) and "move playhead to track above" (p) around the paste actions:sf.keyboard.press({ keys: "semicolon", }); sf.ui.proTools.menuClick({ menuPath: ['Edit', 'Paste'] }); sf.keyboard.press({ keys: 'tab' }); sf.keyboard.press({ keys: "p", });
I'm still trying to figure out if it would be possible to select all tracks at once and have all muted clips move to one or two "MUTED CLIPS TRACKs" at the bottom of the session.
I'm not a programmer so tips are very welcome!Thanks :)
Christian Scheuer @chrscheuer2020-02-23 19:58:22.549Z
Anne, that's a great idea. It should be possible using a combination of a few scripts around here - please feel free to open a new thread for this so we can discuss options there.
- BIn reply toanon6770933309⬆:Tamás Bohács @bohitomi
Thanks, everyone, for making this script!
I made an updated version which goes down and loops itself until the end of the session.
However, you must make an inactive track at the end to stop it.
Does anyone have an idea how to stop it, maybe achieve this in other ways?
Also, has anyone found a solution to recognize clips with sync points?// This script clears all muted clips from the currently selected track, moves to the next track until the end of the session // Note: you have to have an inactive track at the bottom while (true) { // Check if track is selected if (!sf.ui.proTools.getMenuItem('Track', 'Make Inactive').isEnabled) { break; } else { // "Return" key to go to start of session sf.keyboard.press({ keys: 'return' }); // Select first clip sf.keyboard.press({ keys: 'shift+tab' }); // Repeat while audio is still selected while (sf.ui.proTools.getMenuItem('Clip', 'Group').isEnabled) { var clipIsMuted = sf.ui.proTools.hasMenuItem('Edit', 'Unmute Clips'); var clipIsUnmuted = sf.ui.proTools.hasMenuItem('Edit', 'Mute Clips'); var noClips = sf.ui.proTools.hasMenuItem('Edit', 'Mute'); if (clipIsMuted) { // Clip is muted // Delete clip sf.ui.proTools.menuClick({ menuPath: ['Edit', 'Clear'] }); // "Option+Shift+Tab" keys to extend selection to previous Clip-boundary sf.keyboard.press({ keys: 'alt+shift+tab' }); } else if (clipIsUnmuted || noClips) { // Skip clip sf.keyboard.press({ keys: 'tab' }); } // Select next clip sf.keyboard.press({ keys: 'shift+tab' }); } log('Clear Muted Clips', 'All muted clips cleared from this track'); // Go to start of session sf.keyboard.press({ keys: 'return' }); // Select next track sf.keyboard.press({ keys: 'semicolon' }); // Check if there are any more tracks if (!sf.ui.proTools.getMenuItem('Track', 'Make Inactive').isEnabled) { break; } } }