Copy clips to a specific track maintaing time selection
Desired Workflow
I have tracks named after each character, and an aaf from the editor. My task is to watch through the series and mark up the session for an ADR. The way I do it is listening to the session, and when certain character needs ADR, I copy the audio clip of a line from the aaf and place it on a character's track.
Question
I found this thread which moves clips to a specific track - https://forum.soundflow.org/-1551/move-clip-to-specified-track-if-partial-or-full-overwrite-move-to-next-track
This works for me although I changed it to copy rather than cut. However, I'd like the script to ask first which track I need to copy the clip to as I have multiple characters and would like certain clips to be on certain character's tracks. Would it be possible to implement? Thank you!
Command Info
ID: user:default:ckn8oinn000000m102j7102jr
Name: Copy clips to a specific track
Source
function copyButRememberSelection() {
sf.ui.proTools.mainCounterDoWithValue({
targetValue: 'Samples',
action: () => {
//Get original selection
var originalSelection = sf.ui.proTools.selectionGetInSamples();
var editCopy = sf.ui.proTools.getMenuItem('Edit', 'Copy');
if (!editCopy.isEnabled) throw 'No clip selected';
editCopy.elementClick({}, 'Could not cut clip');
sf.ui.proTools.selectionSetInSamples({
selectionStart: originalSelection.selectionStart,
selectionEnd: originalSelection.selectionEnd,
});
}
});
}
function selectionOverlapsWithExistingClip() {
return sf.ui.proTools.getMenuItem("Edit", "Separate Clip", "At Transients").exists;
}
function moveToTracks(trackNames) {
var originalTrackName = sf.ui.proTools.selectedTrackNames[0];
copyButRememberSelection();
var success = false;
for (var i = 0; i < trackNames.length; i++) {
var trackName = trackNames[i];
sf.ui.proTools.trackSelectByName({
names: [trackName],
deselectOthers: true,
});
//Update menu
sf.keyboard.press({ keys: 'cmd+shift+numpad plus,cmd+shift+numpad minus' });
if (selectionOverlapsWithExistingClip())
continue;
var editPaste = sf.ui.proTools.getMenuItem('Edit', 'Paste');
if (!editPaste.isEnabled) throw 'Cannot paste here';
editPaste.elementClick({}, 'Could not paste clip');
success = true;
break;
}
sf.ui.proTools.trackSelectByName({
names: [originalTrackName],
deselectOthers: true,
});
if (!success) {
sf.ui.proTools.getMenuItem('Edit', 'Undo Copy').elementClick();
}
}
moveToTracks([
'M SFX 1',
'M SFX 2',
'M SFX 3',
'M SFX 4',
'M SFX 5'
]);
Links
User UID: 8GQXtNMITwez3W5RV4HPc7GLTw82
Feedback Key: sffeedback:8GQXtNMITwez3W5RV4HPc7GLTw82:-MXl5905WIrPvYtegNav
- Vladimir @poterukha
Hi Olga! I'm glad to see you here at the forum.
As far as I can see from the description of the workflow, you don't need to check each time if the target track has already occupied. So the solution can be much simpler://copy audio from source track sf.ui.proTools.menuClick({ menuPath: ["Edit","Copy"], }); //select target by name (built in command, default shortcut ctrl+F) sf.ui.proTools.trackSelectByNameSearch(); //paste sf.ui.proTools.menuClick({ menuPath: ["Edit","Paste"], });
- Progresswith handling this problem