Hello can i make a loop of a macro but a each loop rename a clip with a different names (ex : monday, tuesday etc ... till sunday)
Other wise i can make a macro for each day but i would like to run the macros one after another, can i do that ?
Thanx
Dustin Harris @Dustin_HarrisHow many clips are you renaming at once? (And in what program?) do you want to add the day of the week to the end of the name that is already there? :)
Kitch Membery @Kitch2021-03-19 20:31:58.150ZAll legitimate questions :-) Nice one @Dustin_Harris !
In reply tobenoit_charbonnier⬆:Kitch Membery @Kitch2021-03-19 20:29:35.759ZThis is one way you could do it. :-)
const daysOfTheWeek = [ 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday', ]; function renameClip(index) { //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' }); //Open menu 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; //Set the value of the textField textField.elementSetTextFieldWithAreaValue({ value: daysOfTheWeek[index] }); //Click OK dlg.buttons.whoseTitle.is('OK').first.elementClick(); //Wait for the dialog to close dlg.elementWaitFor({waitType:"Disappear"}); } function main() { //Make sure Pro Tools main window is active sf.ui.proTools.appActivateMainWindow(); //Loop through Monday - Sunday from the days of the week array. for (let i = 0; i < daysOfTheWeek.length; i++) { //Function for renaming the clip renameClip([i]); //Move to next Clip sf.keyboard.press({ keys: "ctrl+tab", }); } } main();I hope that helps!
- BIn reply tobenoit_charbonnier⬆:benoit charbonnier @benoit_charbonnier
Hello, thanx for the answers, I should have been more specific.
I have 7 clips separated by blank space in a Pro Tools track named audio1_01 etc.. and I want to use 2 shortcuts, the first is to select the next clip and the second is to rename the clip, I did it and it works but now I want to give those clips the names I mentioned before (Monday, Tuesday etc...) and I don't want to repeat the macro 7 times each time with only changing the clip name in it so I wanted to know if there was a way to create a loop but with a different rename action at each time.
Kitch i will try to understand the code you send me but for now I have go, thank you in advance for your effort and I get back to that tomorrow
Edit : I've just read your code quickly and I think it's exactly what I needed so thanx a lot Kitch, I'll try it tomorrow
Edit 2 : I've changed my schedule today and I've just tried your code Kitch, it works perfectly thank you very much I will try to examine it to understand what you did