"smart" pro tools "save as"
hi friends
ok, here's a fun one i can't figure out.
i use the following naming convention in my "save as" for versioning:
SongTitle - Version# - EngineerName - Notes
i would love to have a script that did the following
- started the "save as" process
- found the Version# in the title
- moved the last number up by one
- selected all text at the end of the screen up to the right-most "-"
- that's it! it would the be ready for me to type my "notes"
example:
current session: Stairway To Heaven - 3.6 - pw - auto-tuning the vocals
scripted save-as: Stairway to Heave - 3.6 - pw -
and the cursor would be flashing, ready for typing, one space after that last dash
possible? crazy?
- samuel henriques @samuel_henriques
Hello Philip,
Try this/** * @param {string} name */ function saveSessionAs(name) { sf.ui.proTools.menuClick({ menuPath: ["File", "Save As..."] }); const saveAsWin = sf.ui.proTools.windows.whoseTitle.is('Save').first.elementWaitFor({ waitType: "Appear" }, 'Save as Window Didn\'t Open.').element saveAsWin.textFields.first.value.value = name }; sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.invalidate(); ////// Session name structure SongTitle - Version# - EngineerName - Notes const sessionPath = sf.ui.proTools.mainWindow.sessionPath; const sessionName = sessionPath.split('/').slice(-1)[0].split('.').slice(0, -1).join('.'); const songTitle = sessionName.split(" - ")[0] const versionNumber = sessionName.split(" - ")[1] || "0" const engineerName = sessionName.split(" - ")[2] || "pw" let cleanVersionN = Number(versionNumber.replace(/[.]/g, '')) const newVersionNumber = ++cleanVersionN < 10 ? "0." + cleanVersionN : cleanVersionN.toString().split("").join(".") const newSessionName = songTitle + " - " + newVersionNumber + " - " + engineerName + " - " saveSessionAs(newSessionName)
- MMatt Cahill @Matt_Cahill
Hi guys,
Loving this code, wondered if anyone could help me with a slightly simpler version of this! already tried to make some edits to the code but can't get it to quite work right.
at the moment, say I have "Projectname 06", with my tweaks it comes out as "Projectname 06 01", but I would absolutely love it if it could save up as "Projectname 07", is this possible/easy to do?
thanks!
samuel henriques @samuel_henriques
Hello Matt,
Try this,
it ill grab the last number in the session name and increment by one. If there is no number, will add 02.function saveSessionAs(newSessionName) { sf.ui.proTools.menuClick({ menuPath: ["File", "Save As..."] }); //////////////////////////Whait for Save as... Window///////////////////////////// const saveAsWin = sf.ui.proTools.windows.whoseTitle.is('Save').first.elementWaitFor({ waitType: "Appear" }, 'Save as Window Didn\'t Open.').element saveAsWin.textFields.first.value.value = newSessionName saveAsWin.buttons.whoseTitle.is('Save').first.elementClick(); saveAsWin.elementWaitFor({ waitType: "Disappear" }, 'Save as Window Didn\'t Close.'); } function getNewSessionName() { sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.invalidate(); let newSessionName const sessionPath = sf.ui.proTools.mainWindow.sessionPath; const sessionName = sessionPath.split('/').slice(-1)[0].split('.').slice(0, -1).join('.'); let sessionVersion = sessionName.match(/\d+$/) if (!sessionVersion) { newSessionName = sessionName + " 02" return newSessionName; }; let versionNumber = +sessionVersion[0]; let cleanSessionName = sessionName.split(/\d+$/)[0]; let newVersion = ++versionNumber <= 9 ? "0" + versionNumber : versionNumber return cleanSessionName + newVersion }; let newName = getNewSessionName() saveSessionAs(newName)
- MMatt Cahill @Matt_Cahill
Thanks Sam this is perfect!
- PIn reply toPhilip_weinrobe⬆:Philip weinrobe @Philip_weinrobe
omg this works and is blowing my mind
- PPhilip weinrobe @Philip_weinrobe
here's a highly specific request (if possible!)
i actually use decimal system (1.1, 1.2, 1.3....1.9, 2.0)
possible for this script to go from 1.9 to 2.0 correctly?
if not, i will change my workflow (or i will manually type the right number when going from 9 to 0phil
samuel henriques @samuel_henriques
UPDATED,
As is, it will do it in the order in the list.
If you don't have version number and operator, the script will add them. As long as the song title doesn't have any " - ", this should work.If you have many engineers using this script, and they all have a soundflow account, I can add a bit to always place the engineer name, instead of taking it from the session name.
Stairway To Heaven.ptx
Stairway To Heaven - 0.1 - pw - .ptx
Stairway To Heaven - 0.2 - pw - .ptx
Stairway To Heaven - 0.3 - pw - .ptx
Stairway To Heaven - 0.4 - pw - .ptx
Stairway To Heaven - 0.5 - pw - .ptx
Stairway To Heaven - 0.6 - pw - .ptx
Stairway To Heaven - 0.7 - pw - .ptx
Stairway To Heaven - 0.8 - pw - .ptx
Stairway To Heaven - 0.9 - pw - .ptx
Stairway To Heaven - 1.0 - pw - .ptx
Stairway To Heaven - 1.1 - pw - .ptx
Stairway To Heaven - 1.2 - pw - .ptx
...
Stairway To Heaven - 1.2.0 - pw - .ptx
Stairway To Heaven - 1.2.1 - pw - .ptx
Stairway To Heaven - 1.2.2 - pw - .ptx