Hey Christian!
I saw a couple script to do exactly just that on Tracks and on Sessions, but I can't figure out how to do it for an audio Clip...
I tried for a few hours now, but since my knowledge of Java is limited to copy and paste...
The idea would be to rename multiple audio by incrementing the last number by +1:
"Soundflow_Printmaster_6ch_v1" to "Soundflow_Printmaster_6ch_v2"
"Soundflow_DXstems_6ch_v1" to "Soundflow_DXstems_6ch_v2"
"Soundflow_FXstems_6ch_v1" to "Soundflow_FXstems_6ch_Vv2"
"Soundflow_MXstemsr_6ch_v1" to "Soundflow_MXstems_6ch_v2"
etc...to speed up the process a bit when making deliverables.
Linked from:
- Christian Scheuer @chrscheuer2019-10-31 15:48:10.592Z
Hi Ugo!
What a great idea :)
Something like this should get you started:
function renameClip(callback) { //Make sure Pro Tools Edit Window is active sf.ui.proTools.appActivateMainWindow(); //Make sure we have no search in Clips list - if we had, Clip Rename won't work (Pro Tools bug) sf.keyboard.press({ keys: 'cmd+shift+d' }); //Clip Clip->Rename... sf.ui.proTools.menuClick({ menuPath: ['Clip', 'Rename...'] }); //Wait for 'Name' dialog to come up, assign the dialog to dlg variable var dlg = sf.ui.proTools.windows.whoseTitle.is('Name').first.elementWaitFor({}, 'Could not find "Name" dialog').element; //Find the first text field var textField = dlg.groups.whoseTitle.is('Name').first.textFields.first; //Get the current Name var currentName = textField.value.value; //Make a variable with the new name, based on the old one by calling the callback function provided in the 1st argument var newName = callback(currentName); //Set the value of the textField textField.elementSetTextFieldWithAreaValue({ value: newName }); //Press OK dlg.buttons.whoseTitle.is('OK').first.elementClick(); //Wait for the dialog to close dlg.elementWaitFor({ waitForNoElement: true }); } function processClip() { renameClip(oldName => { var m = oldName.match(/^(.*?)(\d+)$/); if (m && m[2]) { return m[1] + String(Number(m[2]) + 1); } return oldName + '_v2'; }); } sf.ui.proTools.clipDoForEachSelectedClip({ action: processClip });
Christian Scheuer @chrscheuer2019-10-31 15:49:31.876Z
Note this I believe only works if the selected clips are on the same track. I just realized since you're talking about stems they are more likely to be on separate tracks..
But it would be great to start testing this script - just have the clips on the same track to see if it works as intended, then we'll augment it to work on all selected tracks later on.My Apologies, I though I replied a couple weeks ago. I tested it and it does work for audio files located on the same track. Yeah! and Thanks!
Now, how can we script that in order to do it on all selected audio clips, regardless of track they are on?
I tried some more on my own, but no success so far...Christian Scheuer @chrscheuer2019-11-21 02:30:45.932Z
Try this :)
function renameClip(callback) { //Make sure Pro Tools Edit Window is active sf.ui.proTools.appActivateMainWindow(); //Make sure we have no search in Clips list - if we had, Clip Rename won't work (Pro Tools bug) sf.keyboard.press({ keys: 'cmd+shift+d' }); //Clip Clip->Rename... sf.ui.proTools.menuClick({ menuPath: ['Clip', 'Rename...'] }); //Wait for 'Name' dialog to come up, assign the dialog to dlg variable var dlg = sf.ui.proTools.windows.whoseTitle.is('Name').first.elementWaitFor({}, 'Could not find "Name" dialog').element; //Find the first text field var textField = dlg.groups.whoseTitle.is('Name').first.textFields.first; //Get the current Name var currentName = textField.value.value; //Make a variable with the new name, based on the old one by calling the callback function provided in the 1st argument var newName = callback(currentName); //Set the value of the textField textField.elementSetTextFieldWithAreaValue({ value: newName }); //Press OK dlg.buttons.whoseTitle.is('OK').first.elementClick(); //Wait for the dialog to close dlg.elementWaitFor({ waitForNoElement: true }); } function processClip() { renameClip(oldName => { var m = oldName.match(/^(.*?)(\d+)$/); if (m && m[2]) { return m[1] + String(Number(m[2]) + 1); } return oldName + '_v2'; }); } var trackNames = sf.ui.proTools.selectedTrackNames; var tracks = sf.ui.proTools.selectedTrackHeaders; try { //Loop through each originally selected track tracks.map(track => { //Select just this track track.trackSelect(); //Process all clips on this track sf.ui.proTools.clipDoForEachSelectedClip({ action: processClip }, err => { if (err.indexOf('Selecting a full clip failed') < 0 && err.indexOf('DoMainCounter') < 0) throw err; }); }); } finally { //Restore original track selection sf.ui.proTools.trackSelectByName({ deselectOthers: true, names: trackNames, }); }
- In reply tochrscheuer⬆:DDaniel Braunstein @Daniel_Braunstein
Hi guys! This script would be brilliant - I would love to do exactly this, select a clip (bounce mix for example) and rename it with an incremental value at the end. Example "Song 1 MixV3" would automatically be renamed to "Song 1 MixV4" - I tried using this script and nothing happened when I executed. Is it possible to update this to be compatable with current pro tools?
Thanks!
DB
- UIn reply toUgosound⬆:@Ugosound
Cool! Yes it works, but as you mentioned only on 1 single Track.
All selected Audio File in that track are being automatically renamed with a +1 incremented value.
As expected, error message when selecting clips on multiple tracks.I tried to upload a screen capture of that, butthat didn't work...
- In reply toUgosound⬆:Kitch Membery @Kitch2019-11-21 01:34:46.956Z
I was going to ask exactly the same question Ugo!
- In reply toUgosound⬆:Andrew Scheps @Andrew_Scheps
Is there an easy way to apply this to a playlist name? I'd like to be able to duplicate a playlist, incrementing the (original) last number in the name (which is the last digit). So I also need to get rid of the three characters added when you invoke Duplicate Playlist.
Christian Scheuer @chrscheuer2020-02-15 23:12:36.914Z
Moving this to a separate thread:
https://forum.soundflow.org/-1559/auto-naming-playlists-when-duplicating