How to adapt this code to selected tracks
I'd like to adapt this code to effect the selected tracks rather than just a single track. Currently if I select more than one track it only does it to the 1st selected track. Tried changing selectedTrack to selectedTracks, but am getting an error...
sf.ui.proTools.selectedTrack.trackDisplaySelect({
displayPath: ['pan', 'front pos']
onError: 'Continue',
});
sf.ui.proTools.selectedTrack.trackDisplaySelect({
displayPath: ['pan left', 'front pos left']
onError: 'Continue',
});
var size = 'large';
var f = sf.ui.proTools.selectedTrack.frame;
var popupMenu = sf.ui.proTools.selectedTrack.popupMenuOpenFromElement({
relativePosition: { x: f.w - 10, y: 5 },
isOption: true,
isShift: true,
}).popupMenu;
popupMenu.menuClickPopupMenu({
menuPath: [size]
});
sf.keyboard.press({ keys: "alt + f", });
Linked from:
- samuel henriques @samuel_henriques
Hello Steve,
Add your code here, hope it helps:
function action() { /// Code to repeat on every selected track goes here. } //Get selected tracks const originalTracks = sf.ui.proTools.selectedTrackNames; //Do for each track. sf.ui.proTools.selectedTracks.trackHeaders.slice().map(track => { //Select track track.trackSelect(); //Scroll track into View track.trackScrollToView(); action() }); //Restore previously selected tracks sf.ui.proTools.trackSelectByName({ names: originalTracks });
- SSteve Bissinger @sbiss2022-01-30 03:36:49.967Z
Thank you Samuel!
This works, but is a little slow. What I was hoping to simulate is if I had multiple tracks selected and held down opt-shift while selecting the pan lane. That method changes all the track views to that lane at the same time, rather than track by track. Is it possible to just add those modifiers to my original script? Or another way to achieve that?
samuel henriques @samuel_henriques
Yes, it's possible,
sf.ui.proTools.selectedTrack.trackDisplaySelect({ displayPath: ['pan', 'front pos'], selectForAllSelectedTracks: true, });
To find these extra properties, just press F2, and you'll get a list like this.
- SSteve Bissinger @sbiss2022-01-30 18:54:10.878Z
Thanks so much for your help Samuel. This works perfectly! You made me realize that my global trigger F2 (launch Pro Tools) is overriding that function in SF.
- In reply tosamuel_henriques⬆:AAlex Oldroyd @Alex_Oldroyd8
Hi @samuel_henriques I'm struggling to adapt this script to work with Logic pro X. do you have any idea how to do so?
samuel henriques @samuel_henriques
Hello Alex,
I don't have Logic at the moment so won't be able to help there.
But if you were to do it on pro tools it would be like so:sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.invalidate(); //Get selected tracks const originalTracks = sf.ui.proTools.selectedTrackNames; //Do for each track. sf.ui.proTools.selectedTracks.trackHeaders.slice().map(track => { //Select track track.trackSelect(); //Scroll track into View track.trackScrollToView(); //Code to execute here }); //Restore previously selected tracks sf.ui.proTools.trackSelectByName({ names: originalTracks });
Hope this helps you adapt for Logic.
- In reply tosbiss⬆:Kitch Membery @Kitch2022-01-29 23:07:19.645Z
Hi Steve,
Please check this tutorial for how to quote code in the SoundFlow forum, so that it displays in a readable format:
Rock on!
- SSteve Bissinger @sbiss2022-01-30 03:21:29.354Z
I watched it...apologies that after all these years I was still doing it wrong! My questions will be beautifully formatted from now on!
Kitch Membery @Kitch2022-01-30 03:22:49.661Z
Hahahahahah No worries legend :-)