How to Create a Macro to View ONLY Midi Clips in the PT Clips Bin
I'm hoping that there's a way to create a macro or script that would allow for me to quickly view JUST midi clips in the PT Clips bin. I guess I would also need another one that would switch me back to viewing all categories of clips in the Clips bin. A toogle would be nice but I'd settle for 2 separate macros.
The reason for this is because I'm toying with the idea of using a Midi track at the top of the PT edit window and using Midi Clip Groups for cuing purposes. Having a macro that would just show me midi clips would allow me to just display these cues in the clips bin without all of the chaos of the PT clips bin and it's lack of organization. Would this be possible? Here's what I'm attempting to achieve without all of the rediculous clicking that is needed to just show midi clips and then back to the original view.


Thanks in advance!
- Kitch Membery @Kitch2021-09-29 00:39:45.405Z
Ron, mate!!
Here is the simple way of doing it via menu selection.
["Audio", "Video", "Groups", "Auto-Created"].forEach(trackType => { sf.ui.proTools.mainWindow.popupButtons.whoseTitle.is("Clip List").first.popupMenuSelect({ menuPath: ["Show", trackType], }); });
It's not foolproof though. This will just toggle the individual menu items one by one. If I have a chance this week I'll see if I can whip something up that's a bit more robust. :-)
Rock on!
Ben Rubin @Ben_Rubin
hey @kitch,
reviving this thread as the clip bin is fairly under-scripted in SF. I'd love to be able to toggle "Full Path" on and off for example. I'm sure it's not difficult for you but it's beyond my current abilities.
thanks!
Ben Rubin @Ben_Rubin
Check that. Apparently not beyond my abilities after modifying your script, @Kitch
sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.invalidate(); ["Full Path"].forEach(trackType => { sf.ui.proTools.mainWindow.popupButtons.whoseTitle.is("Clip List").first.popupMenuSelect({ menuPath: ["Show", trackType], }); });
but I'm sure you have plenty of ideas to make it better!
b
Kitch Membery @Kitch2022-05-11 19:30:18.042Z
Nice one @Ben_Rubin,
Here it is simplified.
sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.mainWindow.popupButtons.whoseTitle.is("Clip List").first.popupMenuSelect({ menuPath: ["Show", "Full Path"], });
You can also do this using only macros;
- Create a new Macro.
- Add the "Activate Apps Main Window" Macro Action and assign the Application to Pro Tools
- Add an "Open & Select Item in Popup Menu" macro action.
- Use the "Open & Select Item in Popup Menu" "Pick" button to select the "Clip List" popup button in Pro Tools.
- Add the menu path for "Show", "Full Path"
The Macro should then look something like this;
If you then need the Macro in script form you can click the "Convert to Script" button in the header of the Macro.
I hope that helps.
Rock on!
Ben Rubin @Ben_Rubin
cool thanks @kitch!
Ben Rubin @Ben_Rubin
When is the invalidate needed?
Kitch Membery @Kitch2022-05-11 23:20:10.337Z
Ah yes...That's an in-depth question that I could oversimplify. So here is a post that Christian wrote that may help you.
Ben Rubin @Ben_Rubin
I actually need a simplification from that post! I definitely learned that I've probably been over-using it so I need to understand where it is required. Maybe there's a middle-ground explanation?
Ben Rubin @Ben_Rubin
I'd also love an explainer on the differences between app invalidate and mainwindow invalidate, though i suppose this will become clear once i know the main answer.
- In reply toBen_Rubin⬆:
Kitch Membery @Kitch2022-05-13 01:30:38.740Z2022-05-14 08:31:46.478Z
Hi Ben,
This may be an oversimplification. but essentially the
invalidate()
method clears the SoundFlow cache's retained information depending on its position in a line of code.The invalidate() call invalidates the node right to the left, for example...
sf.ui.proTools.mainWindow.invalidate();
... invalidates the
mainWindow
node.So this...
sf.ui.proTools.mainWindow.invalidate().transportViewCluster;
...
invalidate()
method invalidates themainWindow
and EVERYTHING inside the main window, including thetransportViewCluster
.SoundFlow does a pretty good job of invalidating without user intervention but there are some instances when invalidation is needed.
When debugging an issue with a script that you feel may be to do with SoundFlow addressing old information in its cache;
- Add an
invalidate()
as far left as possible in the line of code. - Then incrementally move it to the right till the issue surfaces again.
- And finally adjust it back one more position to the left so that you are invalidating the least amount of cache information, (Note: invalidating nodes can slow down scripts because the invalidated node's information and everything downstream of it needs to be re-collected.)
I'll have a think as to a good example to illustrate where the
invalidate()
method would fix an issue in a script and get back to you.I hope that helps :-)
Rock on!THIS POST HAS BEEN UPDATED 05/14/22
Ben Rubin @Ben_Rubin
Thanks @Kitch! this definitely helps. and yes please, examples will help me even more. i fear i've been over-invalidating!
Kitch Membery @Kitch2022-05-13 01:36:01.888Z
Glad that helps... Will keep you posted on a clear example for sure. :-)
- In reply toBen_Rubin⬆:
Kitch Membery @Kitch2022-05-13 02:12:04.639Z
OK here is a good simple example of how the
invalidate()
method works;Run the following script which should logs the file name and extension of the current Pro Tools session;
sf.ui.proTools.appActivateMainWindow(); //Get the current session path const sessionPath = sf.ui.proTools.mainWindow.sessionPath; //Get the current session file name const sessionFileName = sessionPath.split('/').slice(-1)[0]; log(sessionFileName);
This should log the current Pro Tools session name that is collected from the main window of Pro Tools as seen here;
The log will say;
[LOG] My Session Name.ptx
Which is correct and what we expect :-)
Now, to throw a spanner in the works, let's save the session, giving it a new name... for example, save the session as "New and Improved Session".
The Pro Tools main window will now show this new name;
Now run the script again and you will see that the SoundFlow Cache has retained the information from the previous run of the script. So the result is again;
[LOG] My Session Name.ptx
... which is obviously incorrect.
If we change the script by adding an
invalidate()
method after themainWindow
node. like this;sf.ui.proTools.appActivateMainWindow(); //Get the current session path const sessionPath = sf.ui.proTools.mainWindow.invalidate().sessionPath; //Get the current session file name const sessionFileName = sessionPath.split('/').slice(-1)[0]; log(sessionFileName);
... and run the script again, the script logs the updated session name from the Pro Tools main window;
[LOG] New and Improved Session.ptx
I hope that clarifies invalidation for you. :-)
Rock on!
Chris Shaw @Chris_Shaw2022-05-13 17:48:59.658Z
Invalidating the main window is also necessary after your script adds or deletes a track in the main window.
Christian Scheuer @chrscheuer2022-05-14 08:19:20.103Z
Yes! This is the most common reason to invalidate :)
Ben Rubin @Ben_Rubin
All helpful info for my novice coding. Any other major examples like that?
Thanks, @chrscheuer @Chris_Shaw.
Christian Scheuer @chrscheuer2022-05-16 08:59:39.757Z
You'll also need to invalidate dialog windows if you switch tabs, as that means UI elements get re-generated.
Ben Rubin @Ben_Rubin
what's a tab in this case??
Chris Shaw @Chris_Shaw2022-05-16 15:50:25.165Z
A good example for tabs is the PT prefs window, the tabs run along the top of the window (Display, mixing, etc)
Ben Rubin @Ben_Rubin
got it, thanks
- Add an