Hello everybody.
I was trying to create a simple script to show some groups of tracks. For example, all voiceover tracks have the prefix "☆☆".
So I created a macro with this code. (By the way ... how do you share the box with the code?)
sf.ui.proTools.trackShowByName ({
names: ["☆☆"],
search: true,
});
It works.
However, it would be handy to have this function with toggle, but I didn't understand how to do it ..
do you have any advice?
Linked from:
- samuel henriques @samuel_henriques
Hey @Davide_Docente,
try this:
sf.ui.proTools.appActivateMainWindow(); const trackMatch = sf.ui.proTools.trackNames.filter(x => x.match('☆☆')) globalState.showtoggle = !globalState.showtoggle if (globalState.showtoggle) { // Hide Tracks sf.ui.proTools.trackSelectByName({ names: trackMatch }) sf.ui.proTools.trackVisibilityHideSelected() } else { // Show Tracks sf.ui.proTools.trackShowByName({ names: trackMatch }) }
Dav3 @D_av_3
It works!!
Great!!!
thank you!!- In reply tosamuel_henriques⬆:OOwen Granich-Young @Owen_Granich_Young
This is great! Turned it into a template and already have 3 presets I'm using for it. It's nice how it's slighlty diffrent function then memory locations show/hide because it can just add/subtract from current track you're looking at.
- In reply tosamuel_henriques⬆:GGaston Ibarroule @Gaston_Ibarroule
Hey Samuel. Excuse my ignorance. But how would you include multiple tracks to toggle? I think it's a matter of syntax why I can't add more in the third line:
const trackMatch = sf.ui.proTools.trackNames.filter(x => x.match('PFX_M1', 'PFX_M2'))
It would be amazing if someone could send me in the direction of how to lear to ennumerate within this constants.
Thanks!
samuel henriques @samuel_henriques
Hello Gaston,
Try this,
sf.ui.proTools.invalidate(); const namesToFind = ['PFX_M1', 'PFX_M2'] const foundNames = sf.ui.proTools.trackNames.filter(name => namesToFind.indexOf(name) > -1) globalState.showtoggle = !globalState.showtoggle if (globalState.showtoggle) { // Hide Tracks sf.ui.proTools.trackSelectByName({ names: foundNames }) sf.ui.proTools.trackVisibilityHideSelected() } else { // Show Tracks sf.ui.proTools.trackShowByName({ names: foundNames }) }
- GGaston Ibarroule @Gaston_Ibarroule
Amazing! Works like a charm. I'll try to replicate the constant in other scripts. Thank you @smanuel_henriques !!
samuel henriques @samuel_henriques
Cool,
I just added .invalidate(), it's important in case session track name list changes.
- In reply toD_av_3⬆:Kitch Membery @Kitch2021-03-25 19:09:19.253Z
Hi @Davide_Docente,
Please check this tutorial for how to quote code in the SoundFlow forum, so that it displays in a readable format:
Dav3 @D_av_3
THX!!