Select Track Based on Partial Name of Insert
Hi Geniuses at Soundflow!
I am trying to select all tracks that have a hardware insert on them. I bought Scheps Track Selector ($39) but it's crashing very quickly and I think it may be a bit overbuilt for my limited needs.
I am happy to make a naming convention on all my hardware inserts (for example "hw"). I would then like to have a script that selected all tracks that had an insert with "hw" in the name. i'd like to limit this to visible tracks (no searching my hidden tracks!).
is this possible? I can't seem to figure it out. @Andrew_Scheps seemed to indicate in another thread that this is possible, but i'm just not sure how to do it.
thank you so much!
philip
- In reply toPhilip_weinrobe⬆:Chris Shaw @Chris_Shaw2022-08-19 20:59:59.252Z2022-08-19 21:54:33.169Z
try this:
sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.mainWindow.invalidate(); // Ensure Inserts are visible const AEInsertsMenuPath = ['View', 'Edit Window Views', 'Inserts A-E'] const FJInsertsMenuPath = ['View', 'Edit Window Views', 'Inserts F-J'] const insertsAEShowing = sf.ui.proTools.getMenuItem('View', 'Edit Window Views', 'Inserts A-E').isMenuChecked; const insertsFJShowing = sf.ui.proTools.getMenuItem('View', 'Edit Window Views', 'Inserts F-J').isMenuChecked; if (!insertsAEShowing) sf.ui.proTools.menuClick({ menuPath: AEInsertsMenuPath, targetValue: "Enable" }); if (!insertsFJShowing) sf.ui.proTools.menuClick({ menuPath: FJInsertsMenuPath, targetValue: "Enable" }); // Get visible track headers const visibleTracks = sf.ui.proTools.visibleTrackHeaders; //filter out tracks that are VCA and Basic Folder const tracksWithInserts = visibleTracks.filter(t => !t.title.value.includes("Basic Folder Track")) .filter(tr => !tr.title.value.includes("VCA Track")) .map(i => i.normalizedTrackName); //Declare tracks with hw inserts variable var tracksWithHWInserts = []; //Loop through tracks with inserts, look at each insert name and find track whose insert names contain "hw" // if found, add to tracksWInserts array tracksWithInserts.forEach(track => { sf.ui.proTools.trackSelectByName({ names: [track] }) for (var i = 0; i < 10; i++) { var insertName = sf.ui.proTools.selectedTrack.insertButtons[i].value.invalidate().value; if (insertName.includes("hw")) { tracksWithHWInserts.push(track) } } }) // select tracks with hw inserts sf.ui.proTools.trackSelectByName({ names: tracksWithHWInserts }) // Restore Inserts Views if (!insertsAEShowing) sf.ui.proTools.menuClick({ menuPath: AEInsertsMenuPath, targetValue: "Disable" }); if (!insertsFJShowing) sf.ui.proTools.menuClick({ menuPath: FJInsertsMenuPath, targetValue: "Disable" }); log ("Find tracks w/ hardware inserts",`${tracksWithHWInserts.length} tracks with hardware inserts were found`)
Chris Shaw @Chris_Shaw2022-08-19 21:15:12.469Z
oops! there was an error.
The above code has been edited.- PPhilip weinrobe @Philip_weinrobe
ok this works great EXCEPT it fails if it comes across a folder nested more than 1 folder down in a set. so if i have a folder, inside a folder, inside a folder...that is where the script fails. any way to make it not fail there?
it weirdly opens up the track color menu then kiels over and dies lol.
it says "no track selected in track view" when this happens
- PPhilip weinrobe @Philip_weinrobe
if i close that 2nd gen nested folder, the scripts works perfect
Chris Shaw @Chris_Shaw2022-08-20 00:26:42.104Z
Unfortunately I don't have the time to write the routine that opens all folders before hand.
I suggest you use use @samuel_henriques 's open all folders script first. Then run the above script.
- PPhilip weinrobe @Philip_weinrobe
Hi Chris
Actually, all the folders are already open. I can do that manually. The problem is that the script hangs when it encounters a folder that is 2 "generations" in.What do you think?
Philip- PPhilip weinrobe @Philip_weinrobe
@samuel_henriques
any chance you could help with this? it's so close!thank you everyone!
it's almost perfect...i make sure that all folders are open. however, the script fails if a folder is 2 generations in...
thank you all so much!
philip- TThomas Gloor @Thomas_Gloor
Hey Philip! What are you looking to do? I've been fiddling with some hardware insert scripts. Maybe I can help?
- In reply toPhilip_weinrobe⬆:
samuel henriques @samuel_henriques
Just updated my latest open/close all folders.
Try it, maybe it'll help.
Is there a script to un-fold and fold folder tracks? #post-39are you using Chris Shaw script after my script to open all folders?
- PPhilip weinrobe @Philip_weinrobe
Hi Samuel
Yes, I am using the Chris Shaw script after opening all the folders. The issue with the Chris Shaw script is that it hangs when it encounters an OPEN folder with tracks in it in which the open folder is 2 generations or more down the folder tree. Does that make sense?Philip
- PPhilip weinrobe @Philip_weinrobe
oh, for the Chris Shaw script to find the HW inserts, all folders must be open. that's not a problem and we love it!
samuel henriques @samuel_henriques
is it failing and saying track doesn't have element or similar?
is it on the loop?- PPhilip weinrobe @Philip_weinrobe
yes, that's exactly what is happening. it's also, strangely, opening the color pallette when this happens lol
samuel henriques @samuel_henriques
Do you have video tracks on your session?
samuel henriques @samuel_henriques
I made a tiny tweak on @Chris_Shaw's script ( Chris I hope you don't mind).
Try this instead:sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.mainWindow.invalidate(); sf.ui.proTools.trackDeselectAll(); // Ensure Inserts are visible const AEInsertsMenuPath = ['View', 'Edit Window Views', 'Inserts A-E'] const FJInsertsMenuPath = ['View', 'Edit Window Views', 'Inserts F-J'] const insertsAEShowing = sf.ui.proTools.getMenuItem('View', 'Edit Window Views', 'Inserts A-E').isMenuChecked; const insertsFJShowing = sf.ui.proTools.getMenuItem('View', 'Edit Window Views', 'Inserts F-J').isMenuChecked; if (!insertsAEShowing) sf.ui.proTools.menuClick({ menuPath: AEInsertsMenuPath, targetValue: "Enable" }); if (!insertsFJShowing) sf.ui.proTools.menuClick({ menuPath: FJInsertsMenuPath, targetValue: "Enable" }); // Get visible track headers const visibleTracks = sf.ui.proTools.visibleTrackHeaders; //filter out tracks that are VCA and Basic Folder const tracksWithInserts = visibleTracks.filter(tr => !tr.title.value.includes("Basic Folder Track") && !tr.title.value.includes("VCA Track") && !tr.title.value.includes("Video Track") ); //Declare tracks with hw inserts variable var tracksWithHWInserts = []; //Loop through tracks with inserts, look at each insert name and find track whose insert names contain "hw" // if found, add to tracksWInserts array tracksWithInserts.forEach(track => { // sf.ui.proTools.trackSelectByName({ names: [track] }) for (var i = 0; i < 10; i++) { var insertName = track.insertButtons[i].value.invalidate().value; if (insertName.includes("hw")) { tracksWithHWInserts.push(track) }; }; }); // select tracks with hw inserts sf.ui.proTools.trackSelectByName({ names: tracksWithHWInserts.map(th => th.normalizedTrackName) }); // Restore Inserts Views if (!insertsAEShowing) sf.ui.proTools.menuClick({ menuPath: AEInsertsMenuPath, targetValue: "Disable" }); if (!insertsFJShowing) sf.ui.proTools.menuClick({ menuPath: FJInsertsMenuPath, targetValue: "Disable" }); log("Find tracks w/ hardware inserts", `${tracksWithHWInserts.length} tracks with hardware inserts were found`)
samuel henriques @samuel_henriques
Just changed a mistake.
It might be a bug, in this case if there is any selected track, it wont select the found track.
- In reply tosamuel_henriques⬆:PPhilip weinrobe @Philip_weinrobe
no video tracks :)
- PPhilip weinrobe @Philip_weinrobe
hi @samuel_henriques
that new code you updated won't run at all. fails as soon as I try- PPhilip weinrobe @Philip_weinrobe
oops. i take it back...may work perfect!
- PPhilip weinrobe @Philip_weinrobe
ok it works PERFECT
only weird thing is that it opens the color pallete dialog at the end and i can't figure out why...it's not open in the beginning when i run the script....samuel henriques @samuel_henriques
awesome.
it opens the color palette with my open/close folder tracks script?- PPhilip weinrobe @Philip_weinrobe
hi samuel
i actually am not using your open/close script. i make sure the folders are open manually.
at the end of the Chris Shaw script exactly as you posted it (with the fix) it opens the color pallette window.
weird, right?samuel henriques @samuel_henriques
In the past, I've had similar weird behaviour with the colour palette, but couldn't figure it out, restarting pro tools (not just close and open session) fixed it for me.
I've been trying now different ways to reproduce the error you are getting, but no luck so far.- TTristan Hoogland @Tristan
hey guys!
Just chiming in to say this is amazing (though I'm using it to search for other plugins).
I had a quick question - is there a way to ignore:
Tracks that contain said inserts, but are inactive
Tracks that contain said inserts, but the insert itself is inactiveThanks!
- PPhilip weinrobe @Philip_weinrobe
funny, i deal with this problem all the time and would LOVE a solution for it.
tbh, it forces me to clean up my sessions when i need to do this search. so i'm kinda using it to do some tidying (bye bye to inactive tracks and getting rid of inactive plugins)but, in reality, it would just be nicer if it only grabbed Active Tracks AND Active Inserts.
- PPhilip weinrobe @Philip_weinrobe
hi @samuel_henriques
i finally updated pro tools today to 2024.3 today and soundflow to 5.7.5 and now everything is breaking and i'm combing through to fix.this script here is now broken and would love some help figuring out how to fix it
function main() { sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.mainWindow.invalidate(); const aEInsertMenuPath = ['View', 'Edit Window Views', 'Inserts A-E']; const fJInsertMenuPath = ['View', 'Edit Window Views', 'Inserts F-J']; const insertsAEShowing = sf.ui.proTools.getMenuItem('View', 'Edit Window Views', 'Inserts A-E'); const insertsFJShowing = sf.ui.proTools.getMenuItem('View', 'Edit Window Views', 'Inserts F-J'); if (!insertsAEShowing.isMenuChecked) { sf.ui.proTools.menuClick({ menuPath: aEInsertMenuPath, targetValue: "Enable" }); } if (!insertsFJShowing.isMenuChecked) { sf.ui.proTools.menuClick({ menuPath: fJInsertMenuPath, targetValue: "Enable" }); } let visibleTracks = sf.ui.proTools.invalidate().visibleTrackHeaders; // Filters Tracks without Insert Buttons const tracksWithInsertButtons = visibleTracks.filter(tr => !tr.title.value.includes("Basic Folder Track") && !tr.title.value.includes("VCA Track") && !tr.title.value.includes("MIDI Track") && !tr.title.value.includes("Video Track") ); let tracksWithHWInserts = []; tracksWithInsertButtons.forEach(track => { let trackHasHardwareInsert = track.insertButtons.filter(btn => btn.value.invalidate().value.includes("*"))[0]; let trackHasTrackspacer = track.insertButtons.filter(btn => btn.value.invalidate().value.includes("Trackspacer"))[0]; if (trackHasHardwareInsert || trackHasTrackspacer) { tracksWithHWInserts.push(track); } }); sf.ui.proTools.trackSelectByName({ names: tracksWithHWInserts.map(th => th.normalizedTrackName), deselectOthers: true }); } main();
samuel henriques @samuel_henriques
from what I can see, inserts might be getting a new nomenclature so it doesn't see the "*" or "Trackspacer" value on inserts.
Another problem you might get is, if the track hight hides inserts (smaller than medium), you'll get an error and the script will break. This problem is not new.what are the insert names you are looking for?
- PPhilip weinrobe @Philip_weinrobe
i am looking for "" and it's always worked up till now...
i put "" into my hardware insert names, and this script basically finds all my hardware inserts.let me do a little more troubleshooting. i know about track heights and errors for this script, and i make sure the height is taller than medium
samuel henriques @samuel_henriques
your insert names still have "*" on the name?
I tried it here and it finds it.
PT 2024.3 on osx 13.6.4