Are there more advanced ways to edit text with soundflow. For example if I want to rename a track and add text to a part of the existing text or make a prefix? Can soundflow work with RegEx? I'm sure everything can be done easily with scripting but for those of us without scripting know how is there easier ways?
- Christian Scheuer @chrscheuer2024-01-31 01:09:16.023Z
This would have to be done with scripting, but even without understanding scripting, I think it should be possible for you to edit to your needs.
Add a prefix before the track name of all currently selected tracks:
for (let trackName of Array.from(sf.ui.proTools.selectedTrackNames)) { sf.app.proTools.renameTrack({ oldName: trackName, newName: 'prefix' + trackName, }); }
Note that this uses a PT SDK function that doesn't store the action in the undo queue, so be sure to have your session saved before starting to test.
Here's an example of doing the same thing but with a regex replace (here, it's replacing any digit with the letter d):
for (let trackName of Array.from(sf.ui.proTools.selectedTrackNames)) { sf.app.proTools.renameTrack({ oldName: trackName, newName: trackName.replace(/[0-9]/g, 'd'), }); }
- JIn reply toJosh_Reinhardt⬆:Josh Reinhardt @Josh_Reinhardt
Thats cool! How would you rename just the selected track? Also can the text pop up be used to enter text to be recalled by a different macro?
Christian Scheuer @chrscheuer2024-01-31 05:26:58.909Z
just the selected track
This takes all selected tracks, so if one track is selected, it would rename that, if 2 tracks are selected, it would rename both, etc... Do you mean renaming only the first out of potentially many selected tracks?
- JJosh Reinhardt @Josh_Reinhardt
No that makes sense thanks. I'm trying to enter a scene # into this popup and insert that text later on to rename a track. Would this "text popup" window be able to set a text variable like that? and how would I recall said variable for later use?
Christian Scheuer @chrscheuer2024-01-31 05:39:55.124Z
It's easier in this case if you try to ask for the full workflow you're trying to achieve ("for later use"), otherwise we may be giving you the wrong pieces/building blocks.
- JJosh Reinhardt @Josh_Reinhardt
I was just trying to find an easy way to build a track name using this specific naming convention. I dont have the convention in front of me. But basically Its something like: Scene#_Date_CharacterName (0045_012924_JohnnyButt)
So I wanted to press a button that has the name of a character JohnnyButt, then a pop up asks for the scene# and it automatically enters the date.
I may not use this but I'm just seeing if I can figure it out and it seems I need to know scripting to do many things in SF.
Christian Scheuer @chrscheuer2024-01-31 17:02:02.990Z
Hi Josh,
Yes, you're right, it is needed to know scripting to do more advanced things in SF, for example when accessing variables and substituting string values etc.
You could achieve what you just mentioned through:
//Prompt the user to enter a scene number let sceneNum = prompt(`Scene #`); //Construct the final track name, substituting the scene number using ${...} syntax let trackNameTemplate = `Scene${sceneNum}_Date_CharacterName (0045_012924_JohnnyButt)`; //Rename the currently selected track sf.app.proTools.renameTrack({ oldName: sf.ui.proTools.selectedTrackNames[0], newName: trackNameTemplate, });
- JJosh Reinhardt @Josh_Reinhardt
I did take a C++ class a long time ago. So I know a tiny bit, maybe I will start learning a bit more. Do you have any resources to learn the basics? Have you had success using generative AI to write script?
- JJosh Reinhardt @Josh_Reinhardt
Also how is the "Text Popup" macro to be used? How can the input be later used?
Christian Scheuer @chrscheuer2024-01-31 18:02:41.963Z
There is some good getting-starting content for Javascript here:
https://soundflow.org/docs/how-to/custom-commands/javascript-resources- In reply toJosh_Reinhardt⬆:
Christian Scheuer @chrscheuer2024-01-31 18:03:34.135Z
You can drag the orange "text" output into the input of another action, like for example:
- In reply tochrscheuer⬆:JJosh Reinhardt @Josh_Reinhardt
That is very handy! So I got in to work and I see now what is needed. The naming convention is:
Episod_Date_Scene_Character_TK. So an example would be: BM803_013024_SC000_Kitty_TK. So what I want is to be able to quickly change the scene or the character via popup.So I'd press a button and a popup would come up and ask for the new scene. I put in 54 and the new name would be BM803_013024_SC054_Kitty_TK
Or I'd press a different button and a popup would ask for a new character. I would put in Bob and the new name would be BM803_013024_SC000_Bob_TK.
I know this is all possible but not sure exactly how to do it.
Christian Scheuer @chrscheuer2024-01-31 22:31:09.883Z
This allows you to change the scene part:
//Get the name of the currently selected track (takes only the first if multiple are selected) var existingTrackName = sf.ui.proTools.selectedTrackNames[0]; //Deconstruct the track name by splitting by "_" var [episode, date, scene, character, take] = existingTrackName.split('_'); //Change the "scene" scene = prompt(`Scene:`, scene); //Reconstruct the new track name var newTrackName = [episode, date, scene, character, take].join('_'); //Perform the rename sf.app.proTools.renameTrack({ oldName: existingTrackName, newName: newTrackName, });
You only need to change line 9 to change which part of the track name you'd like the script to change.
- JIn reply toJosh_Reinhardt⬆:Josh Reinhardt @Josh_Reinhardt
Very cool the script seems to work at my house but not at work. I get an error saying that Protools is too old? (BTW //having the explanation in the script is helpful thank you! )
Since the scene is always "SC000" how would you write the script so "SC" is always the same and you only need to input a number?
For example for scene 32: The popup comes up and I can just type "032" or "32" instead of "SC032".
(Same thing with the episode, EP is always used before the number.)The sessions run very fast so being able to save as much time as possible is amazing.
Christian Scheuer @chrscheuer2024-02-01 00:35:31.330Z
This implementation uses the Scripting SDK from Pro Tools to perform the rename. You can make the script do the rename via the UI instead. This will be slightly slower (it has to open the track rename popup dialog), but would work also on older versions of Pro Tools.
- JJosh Reinhardt @Josh_Reinhardt
How would one make the script via UI? Sorry I'm not more knowledgeable :/
Christian Scheuer @chrscheuer2024-02-01 02:12:04.663Z
No need to apologize :) But I might not have much more time to help with this particular case - hopefully the community can chime in to help you get the rest of the way if the following doesn't get you all the way.
Here's the same script I shared before, but using UI automation to perform the rename. Note, in addition to working on all supported versions of Pro Tools, this also has the added benefit of adding the rename to the undo queue, so you can hit undo afterwards:
//Get the name of the currently selected track (takes only the first if multiple are selected) var existingTrackName = sf.ui.proTools.selectedTrackNames[0]; //Deconstruct the track name by splitting by "_" var [episode, date, scene, character, take] = existingTrackName.split('_'); //Change the "scene" scene = prompt(`Scene:`, scene); //Reconstruct the new track name var newTrackName = [episode, date, scene, character, take].join('_'); //Perform the rename sf.ui.proTools.selectedTrack.trackRename({ newName: newTrackName, });
Christian Scheuer @chrscheuer2024-02-01 02:13:30.704Z2024-02-01 05:24:30.918Z
The corresponding script for changing the Character field would then be:
//Get the name of the currently selected track (takes only the first if multiple are selected) var existingTrackName = sf.ui.proTools.selectedTrackNames[0]; //Deconstruct the track name by splitting by "_" var [episode, date, scene, character, take] = existingTrackName.split('_'); //Change the "character" character = prompt(`Character:`, character); //Reconstruct the new track name var newTrackName = [episode, date, scene, character, take].join('_'); //Perform the rename sf.ui.proTools.selectedTrack.trackRename({ newName: newTrackName, });
- JJosh Reinhardt @Josh_Reinhardt
Awesome thank you hopefully that will work for now! It was nice meeting you at NAMM, I wish I could have chatted longer. I was hanging out with Barry
- In reply tochrscheuer⬆:JJosh Reinhardt @Josh_Reinhardt
I have been frequently getting an error message "could not open track rename dialog". Not sure how to solve this. It happens once in a while.
here is some of the error logs: 19.03.2024 08:32:59.95 [Backend]: Logging error in action (01) WaitForPopupMenuAction: Popup window was not found after waiting 2000 ms
Logging error in action (01) OpenPopupMenuFromElementAction: Popup menu was not found
Logging error in action (01) OpenTrackRenameDialogAction: Could not right-click Track's title button
Logging error in action (01) TrackRenameAction: Could not open Track Rename dialog19.03.2024 08:32:59.95 [Backend]: !! Command Error: Swamp Ep [user:clrzven1q0000cm106k2v6wc3:clthto4kd000c1v10an0r445t]:
Could not open Track Rename dialog (Swamp Ep: Line 17)
Could not right-click Track's title button
Popup menu was not found
Popup window was not found after waiting 2000 ms<< Command: Swamp Ep [user:clrzven1q0000cm106k2v6wc3:clthto4kd000c1v10an0r445t]
19.03.2024 08:32:59.95 [Backend]: Logging error in action (01) DeckOpenAction: Couldn't find deckInfo
19.03.2024 08:33:04.56 [EditorWindow:Renderer]: Active Focus Container: app Line 33963 file:///Applications/SoundFlow.app/Contents/Helpers/SoundFlow.app/Contents/Resources/app.asar/dist/editor.js
Christian Scheuer @chrscheuer2024-03-19 15:54:56.134Z
Be sure to check the latest 5.7.4 build to see if it's fixed. If not, please open a new support ticket:
- JIn reply toJosh_Reinhardt⬆:Josh Reinhardt @Josh_Reinhardt
Yup that was the problem. Please disregard the support ticket I sent!