Apply "Clip Do For Each Selected Clip" on clips within different tracks
By alex alcanjim @alex_alcanjim
Hi all!
I'm just working around some scripts using "ClipDoForEachSelectedClip". The thing is that I would need to make it work when "selected clips" come from different tracks (you can find and example in the following screenshot)

Here comes the script I'm using now, but It only works if all selected clips are in the same track.
sf.ui.proTools.appActivateMainWindow();
function duplicate() {
//Calling command "Open, Render and Close AudioSuite Plugin" from package "undefined" (installed from user/pkg/version "srAasovvDiQacRZ2mcId4RrOA8R2/ckp49i4j60000a2100yfwywgf/cln0nxiji0000yp102352fxp9")
sf.soundflow.runCommand({
commandId: 'user:ckp49i4j60000a2100yfwywgf:ckoo6b1uu000myj10s1rc02md',
props: {
category: "Other",
pluginName: "Duplicate",
}
});
}
sf.ui.proTools.clipDoForEachSelectedClip({action:duplicate});
Thanks so much in advance for your help!
- Nathan Salefski @nathansalefski
So long as you have the 'Link Track and Edit Selection' enabled, you can try something like this:
function duplicate() { // Put Stuff Here } function main() { sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.mainWindow.invalidate(); let selectedTracks = sf.ui.proTools.selectedTrackNames; selectedTracks.forEach(track => { sf.ui.proTools.trackSelectByName({ names: [track], deselectOthers: true, }); sf.ui.proTools.selectedTrack.trackScrollToView(); sf.ui.proTools.clipDoForEachSelectedClip({ action: duplicate }); }); } main();
- Aalex alcanjim @alex_alcanjim
Wow!
It works perfectly! Thanks so much for this!
Cheers!