ADMIN EDIT:
See post https://forum.soundflow.org/-1555#post-8 for the real question
Sorry to bombard you with questions...
Is there a way to use wildcards in the parameters in Actions? For instance, I would like be able to select a specific group in the group dialog by id regardless of its name. Using the "select from popup menu" won't work because it needs the complete text of the menu item, which will obviously change depending on the name of the group.
In reply toAndrew_Scheps⬆:Christian Scheuer @chrscheuer2020-02-15 11:46:29.536ZThere are a couple of ways to achieve this in scripting (and some of the actions support wildcards natively as a quicker way to approach the same thing). I saw you closed the topic - did you find a solution?
- MMichael Perricone @Michael_Perricone
I'm trying to toggle the record-armed tracks between input and playback. I tried the pre-built "set record tracks to input only" command and it works to toggle to input, but fails to toggle back to playback giving the error message reflecting that the Tracks Menu item switches name to "set record tracks to auto-input". ideally one button should toggle the input stat. Option-K from the keyboard works perfectly, but when I program a macro with the Keyboard command type text causing it to output option-k, it doesn't work at all. If I select rename a track and hit the programmed stream deck key to type the option-k it does enter the appropriate character (˚). Any suggestions?
Andrew Scheps @Andrew_SchepsYou should start a new thread with new questions, but in this case it's pretty easy. You're using the wrong action. Set up a macro like this and assign it to a button:

- MMichael Perricone @Michael_Perricone
I felt it was part of this thread. Which command are you using to record that macro?
Andrew Scheps @Andrew_SchepsIt's a macro in SoundFlow
Andrew Scheps @Andrew_SchepsSorry, it says at the top of the action: Press Keys
- MMichael Perricone @Michael_Perricone
Found it and it works! Thanks so much!
- In reply toAndrew_Scheps⬆:Comment deleted
Andrew Scheps @Andrew_SchepsStep 1
Step 2

In reply toAndrew_Scheps⬆:Andrew Scheps @Andrew_SchepsI found the wildcards toggle right after I sent the question. This program is awesome!
Christian Scheuer @chrscheuer2020-02-15 11:53:46.492ZGreat :) Thank you for the kind words!
In reply toAndrew_Scheps⬆:Andrew Scheps @Andrew_SchepsHi again. I'm wondering if there is a reference for using wildcards in scripts?
Christian Scheuer @chrscheuer2020-02-15 11:56:46.148ZWe don't have a complete script reference yet.
The best way to discover new actions is to either use
-
Code Completion.
See here: https://soundflow.org/docs/how-to/custom-commands/using-code-completion -
or create Macro actions and then convert them to Javascript.
See the videos here for how to create macros and then convert them to Javascript:
https://youtu.be/20ECpTUy_jk?t=231
https://www.youtube.com/watch?v=vZmFMfT0GOc
-
- In reply toAndrew_Scheps⬆:
Andrew Scheps @Andrew_SchepsIm asking because I modified your script to toggle stem input states and I'd like to do it with wildcards for the track name rather than being so explicit. I also have a feeling my script is a little more complicated than it needs to be since I'm only toggling one track. Here's what I've got:
//Define the track name var mix = ['Print']; //Show the track if it isn't already //sf.ui.proTools.trackShowByName({names: mix}); //Select print track sf.ui.proTools.trackSelectByName({names: mix}); sf.keyboard.press({keys: 'shift+i'});
Christian Scheuer @chrscheuer2020-02-15 11:58:33.437ZAh yes, we can make this more efficient. Do you want to support for this to work always on just the first track containing the word "Print" or on all tracks matching it?
Andrew Scheps @Andrew_SchepsI'm not really sure yet as I need to figure out what naming scheme will work best once I'm playing with it more. Is it difficult to show me both ways?
The other thing is that the track I want to toggle will ALWAYS be the last track in the session so if there is a way to toggle based on that rather than name that would be even better (without having to scroll the session)!
Christian Scheuer @chrscheuer2020-02-15 12:02:45.316ZThis script will toggle the input state of any track that contains the word "print":
function toggleInput(trackName) { var track = sf.ui.proTools.trackGetByName({ name: trackName, makeVisible: true, }).track; var inputBtn = track.buttons.whoseTitle.is('TrackInput Monitor').first; inputBtn.elementClick(); } function toggleInputContaining(partialTrackName) { var matchingTrackNames = sf.ui.proTools.trackNames.filter(n => n.toLowerCase().indexOf(partialTrackName.toLowerCase()) >= 0); matchingTrackNames.map(toggleInput); } toggleInputContaining('print');
Christian Scheuer @chrscheuer2020-02-15 12:04:35.732ZThis script will toggle the input state of the last track in the session (and make it visible if it needs to):
function toggleInput(trackName) { var track = sf.ui.proTools.invalidate().trackGetByName({ name: trackName, makeVisible: true, }).track; var inputBtn = track.buttons.whoseTitle.is('TrackInput Monitor').first; inputBtn.elementClick(); } function toggleInputOfLastTrack() { var lastTrackName = sf.ui.proTools.trackNames.slice(-1)[0]; toggleInput(lastTrackName); } toggleInputOfLastTrack();
Andrew Scheps @Andrew_SchepsBrilliant! I'll try and get my head around the code and I'm sure I'll have more questions. Thanks for all your help!
Christian Scheuer @chrscheuer2020-02-15 12:07:42.985ZGreat! Happy to have you on board :)
Christian Scheuer @chrscheuer2020-02-15 12:09:49.161ZBy the way, make sure to check out our Stream Deck integration (especially how you can design your own Decks inside SoundFlow) - I think that would go well together with the scripts you're working on.
There's a walk through of creating your own decks in one of the videos I linked to.
Andrew Scheps @Andrew_SchepsI'm definitely considering one!
I'm also messing around with trying to build surfaces and I'm having some macros fail (like colouring tracks). The macro works from the keyboard trigger but when I try to trigger it from a surface button I get an error that it can't find the colour palette.
I think this may just be a bug. My macro colours the tracks no matter how I select the track names. If I set the colour palette to "Tracks" explicitly before hitting the surface button it works correctly, but if it is set to "Clips in Tracks" (which it would be after dragging a selection in the edit window) then it gives an error.
Christian Scheuer @chrscheuer2020-02-15 12:35:24.280ZCool!
It's likely that you'll need to insert a "Activate App's Main Window" action in the first line of your script/macro to make sure PT is showing its floating windows.
Andrew Scheps @Andrew_SchepsThat did it, thanks! Should I have that Action at the beginning of every macro to ensure it will work from a surface?
Christian Scheuer @chrscheuer2020-02-15 12:42:27.435ZI very often have that command first in my scripts yea. It also makes for easier debugging if you want to click "Run Macro" or "Run Script" from inside SoundFlow. So yea it doesn't hurt to have it there and it tends to make things more stable.
Andrew Scheps @Andrew_SchepsGreat, modifying all my scripts now. And I believe I read somewhere that I won't have to update all my scripts for new builds of Pro Tools, it actually uses the GUID not the app name. Is that correct? Otherwise that's a lot of stuff to have to change!
Christian Scheuer @chrscheuer2020-02-15 12:45:22.366ZCorrect, we store the bundle ID of the app you select, the name is just for display. So yes it will work across different PT versions.
Andrew Scheps @Andrew_SchepsAmazing
In reply toAndrew_Scheps⬆:Matthew Facca @Matthew_FaccaHey guys, I apologize if I'm hijacking this thread, but I'm looking to do something similar with a slight variation on this.
I'm trying to toggle the input state of my print track. Its name is always changing depending on whether I'm toggling between my active mix and a reference track, previous mix, etc. However; its input bus name is always the same.
I've gotten as far as this, which is obviously oversimplified and works inconsistently:
sf.ui.proTools.trackGotoByInputName({ inputName: "PRINT", }); sf.keyboard.press({ keys: "shift+i", });I've stolen this from a previous post Christian had made, but I've been unsuccessful at adapting it to the track input as opposed to the track name.
function trackToggleInput(trackName) { var track = sf.ui.proTools.trackGetByName({ name: trackName }).track; var inputBtn = track.buttons.whoseTitle.is('TrackInput Monitor').first; inputBtn.elementClick(); } trackToggleInput('PRINT');I've tried to use this line which I grabbed from converting a macro to script, but haven't been able to work out the syntax. More javascript practice is definitely in order...
sf.ui.proTools.trackGotoByInputName({ inputName: "PRINT", });
Andrew Scheps @Andrew_SchepsI haven't used the
trackGoToByInputNamefunction, but I believe this will select the track, so you just need to add a line that passes that track name to thetrackToggleInputfunction:Try:
sf.ui.proTools.trackGotoByInputName({ inputName: "PRINT", }); let trackName = sf.ui.proTools.selectedTrackNames[0]; trackToggleInput(trackName);
- TIn reply toAndrew_Scheps⬆:Tom Mochiach @Tom_Mochiach
maybe its a good idea to add a stream deck indicator to toggle input monitoring so you can also view the action when looking at the stream deck assigned button
- Progress