Script to import Audio into template and rename template without opening session
HI! I'm brand new to SoundFlow so I apologize if there is an obvious answer to this. I'm just finding my bearings.
I made a macro in Keyboard Maestro whereby I can select an audio file (or collection of audio files) in the finder, run the macro and have it create a file structure on my work drive for each selection, copy the audio file to the new folder location and import a DAW template into the folder.
I then have to manually open the template and set up the session.
I would love to find a script that can import the audio file into the template, set the Db level for the imported audio track, append the name of the audio file to all the tracks in the template and save the session with a new name. without having to open the session file.
Is this possible? and would anyone be so kind as to help me create it or point me in the right direction?
Thanks!!
- Chris Shaw @Chris_Shaw2023-03-08 22:16:51.781Z
Unfortunately there's now way to rename a track in a session without opening the session file.
- Ffiddleboy73 @fiddleboy73
Hey Thanks for the quick reply!
what about adding a new track and importing the audio file to it?
Chris Shaw @Chris_Shaw2023-03-08 22:25:57.160Z
You cannot modify a session at all without it being open.
- Ffiddleboy73 @fiddleboy73
Sorry if I am being bothersome. Just trying to figure out if this is the right tool for what I want to accomplish.
Is it possible to setup a script that would (with the session open) utomatically grab the name of the session and prefix it to the name of the selected tracks?
Chris Shaw @Chris_Shaw2023-03-09 20:29:44.747Z2023-03-09 20:39:26.685Z
This should do it.
This script will put " - " (space-dash-space) between the session name and the track name. To change this just change the value of thedivider
constant in line 48// Switch to PT and clear cache sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.mainWindow.invalidate(); //get session name var sessionPath = sf.ui.proTools.mainWindow.sessionPath; var sessionName = sessionPath.split('/').slice(-1)[0].split('.').slice(0, -1).join('.'); // Get selected Tracks const selectedTracks = sf.ui.proTools.selectedTrackNames; //Scroll to first selected track and reselect selectedTracks sf.ui.proTools.trackSelectByName({ names: [selectedTracks[0]] }); sf.ui.proTools.selectedTrack.trackScrollToView(); sf.ui.proTools.trackSelectByName({ names: selectedTracks }); // Open Batch rename window sf.ui.proTools.selectedTrack.titleButton.popupMenuSelect({ isRightClick: true, menuPath: ["Batch Rename..."], }); // Make reference to Batch Rename window const batchRenameWindow = sf.ui.proTools.windows.whoseTitle.is("Batch Track Rename").first; // Wait for batch rename window to open batchRenameWindow.elementWaitFor(); // Disable all checkboxes const batchCheckBoxes = batchRenameWindow.checkBoxes.map(cb => cb.checkboxSet({ targetValue: "Disable" })); // Define checkboxes to set const batchCheckBoxesToSet = { "Add": "Enable", "Prefix:": "Enable", "Insert:": "Disable", "Suffix:": "Disable", } //Set checkboxes for (let key in batchCheckBoxesToSet) { batchRenameWindow.checkBoxes.whoseTitle.is(key).first.checkboxSet({ targetValue: batchCheckBoxesToSet[key] }) }; //Define divider between session name and track name const divider = " - " // Enter session name and divider into prefix field batchRenameWindow.textFields.allItems[6].elementSetTextFieldWithAreaValue({ value: sessionName + divider }) // click "OK" to close batch rename window and batch rename selected tracks batchRenameWindow.buttons.whoseTitle.is("OK").first.elementClick(); //Wait for batch rename window to close batchRenameWindow.elementWaitFor({ waitForNoElement: true });
- Ffiddleboy73 @fiddleboy73
WOW!! this is great. thank you so much. you just saved me hours of trial and error coding and made my life so much better.