Hello,
I managed to do this script to copy the track name to the clip name.
This is for my stem tracks, each track only has one clip.
sf.ui.proTools.selectedTrack.trackOpenRenameDialog();
sf.wait({
intervalMs: 10,
});
sf.ui.proTools.menuClick({ menuPath: ['Edit', 'Copy'] });
sf.keyboard.press({
keys: "return",
});
sf.ui.proTools.menuClick({ menuPath: ['Clip', 'Rename...'] });
sf.ui.proTools.windows.whoseTitle.is('Name').first.groups.whoseTitle.is('Name').first.radioButtons.whoseTitle.is('name clip only').first.checkboxSet({
targetValue: "Enable",
});
sf.ui.proTools.menuClick({ menuPath: ['Edit', 'Paste'] });
sf.ui.proTools.windows.whoseTitle.is('Name').first.buttons.whoseTitle.is('OK').first.elementClick()
Could you help me change this so it would to this on every selected track?
Thank you so much
- samuel henriques @samuel_henriques
right...
once again I couldn't let go and spend the past hours trying to figure this out...
I don't know how to code so this is all done with the help of the incredible search function of the forum.This script will change the clip name to be the same as the track name, on all selected tracks and in the end open the batch rename to I can add a version in the end.
This is meant rename stem files, assuming there is only one file pre track. It will work if there's more than one clip on the track.
for that, I guess consolidate clips before will make it workthis is a newbie's code, so if you could find anything to be improved please let me know.
sf.ui.proTools.appActivateMainWindow(); function rename() { sf.ui.proTools.selectedTrack.trackOpenRenameDialog(); sf.wait({ intervalMs: 5, }); sf.ui.proTools.menuClick({ menuPath: ['Edit', 'Copy'] }); sf.keyboard.press({ keys: "return", }); sf.ui.proTools.menuClick({ menuPath: ['Clip', 'Rename...'] }); sf.ui.proTools.windows.whoseTitle.is('Name').first.groups.whoseTitle.is('Name').first.radioButtons.whoseTitle.is('name clip only').first.checkboxSet({ targetValue: "Enable", }); sf.ui.proTools.menuClick({ menuPath: ['Edit', 'Paste'] }); sf.ui.proTools.windows.whoseTitle.is('Name').first.buttons.whoseTitle.is('OK').first.elementClick() } function main() { //Invalidate Pro Tools main window. sf.ui.proTools.mainWindow.invalidate(); //Get selected tracks const originalTracks = sf.ui.proTools.selectedTrackNames; //Scroll first selected track to into view sf.ui.proTools.selectedTrack.trackScrollToView(); //Do for each track. sf.ui.proTools.selectedTracks.trackHeaders.slice().map(track => { //Select track track.trackSelect(); rename(); //Scroll track into View track.trackScrollToView(); //Fetch track title let selectedTrackTitle = track.title.invalidate().value; }); //Restore previously selected tracks sf.ui.proTools.trackSelectByName({ names: originalTracks }); } main(); sf.keyboard.press({ keys: "ctrl+shift+r", }); sf.ui.proTools.windows.whoseTitle.is('Batch Clip Rename').first.buttons.whoseDescription.is('').allItems[4].elementClick();
Thank you so much
Kitch Membery @Kitch2020-08-31 00:29:05.930Z2020-08-31 00:47:38.000Z
Try this mate!
function renameClip() { //Get selected track Name let trackName = sf.ui.proTools.selectedTrackNames[0]; //Open Rename window sf.ui.proTools.menuClick({ menuPath: ['Clip', 'Rename...'] }); //Reference for Rename Window const win = sf.ui.proTools.windows.whoseTitle.is('Name'); //Wait for rename Window win.first.elementWaitFor(); //Set the clip name to Track name win.first.groups.first.textFields.first.elementSetTextFieldWithAreaValue({ value: trackName, }); //Click OK win.first.buttons.whoseTitle.is('OK').first.elementClick() } function main() { //Invalidate Pro Tools main window. sf.ui.proTools.mainWindow.invalidate(); //Get selected tracks const originalTracks = sf.ui.proTools.selectedTrackNames; //Scroll first selected track to into view sf.ui.proTools.selectedTrack.trackScrollToView(); //Do for each track. sf.ui.proTools.selectedTracks.trackHeaders.slice().map(track => { //Select track track.trackSelect(); //Scroll track into View track.trackScrollToView(); //Run Rename Clip function renameClip(); }); //Restore previously selected tracks sf.ui.proTools.trackSelectByName({ names: originalTracks }); //Open Batch Clip Rename sf.ui.proTools.mainWindow.popupButtons.whoseTitle.is('Clip List').first.popupMenuSelect({ menuPath: ["Batch Rename..."], }); sf.ui.proTools.windows.whoseTitle.is('Batch Clip Rename').first.elementWaitFor(); } main();
Great work figuring it out!
Here are a few changes. I've removed some unnecessary mouse click and keyboard automation to make the script more robust and snappy.
More could be done to make it more robust and more error handeling could be added but this should do the trick.
Rock on!
samuel henriques @samuel_henriques
Hey Kitch,
Awesome, thats way better.Thank you so much!!!!
Kitch Membery @Kitch2020-08-31 09:10:04.362Z
A pleasure as always mate :-)
- MIn reply tosamuel_henriques⬆:Matt Friedman @Matt_Friedman
I would love to see the opposite of this. Copy clip name to track name, for currently selected clips/tracks.
- TTom Davis @Tom_Davis
yes me too! AND enter the copied clip name into the comments box as well that track name. Anyone?
samuel henriques @samuel_henriques
Helo,
Try this and let me know. If it's not working well, I might have another one
- JIn reply tosamuel_henriques⬆:Jack Byrne @Jack_Byrne
Hey! Newbie to SF here, tried running this script and get an error from the updated script that @Kitch posted, stops at line 50 (the batch rename section). Mostly needed the renaming clips by tracks bit, but I thought I'd let folks know as I've not a clue how to troubleshoot script yet!
samuel henriques @samuel_henriques
Hello Jack,
I don't remember exactly where I went from here with this script. It seams that after renaming the clips I wanted do do more with the batch rename.If you remove these lines, it should rename the clips with track name. But this only works if you only have one clip on each track.
Remove this:
//Open Batch Clip Rename sf.ui.proTools.mainWindow.popupButtons.whoseTitle.is('Clip List').first.popupMenuSelect({ menuPath: ["Batch Rename..."], }); sf.ui.proTools.windows.whoseTitle.is('Batch Clip Rename').first.elementWaitFor();
- PIn reply tosamuel_henriques⬆:Pete Watson @Pete_Watson
Great work on this - very helpful thanks!
I think the error on line 50 will happen if the clip list window is hidden (which makes sense as then batch rename isn't available).
I'm new to this but will try and put in a check for that and repost if I succeed. Also it's worth disabling groups, and checking to make sure "link edit and track selection" is active too as I for one have that disabled... back soon :)
samuel henriques @samuel_henriques
Hello Pete,
You are correct.You can add:
sf.ui.proTools.menuClick({ menuPath: ["View", "Other Displays", "Clip List"], targetValue: "Enable" })
before line 49
//Open Batch Clip Rename
and it should be fine.