ok this is the script I'm trying
var num = sf.ui.proTools.selectedTrackCount;
var track = 'Untreated '
for (var i =1; i-1 < num; i++){
sf.ui.proTools.trackSelectByName({names: [track + i.toString()]});
}
I know what's wrong (the array in the for loop go through the numbered tracks one after the other), but I don't know how to fix it (should take some javascript classes, or any language probably) so that SF select all the tracks, not just the last one.
In theory, the 'names' array should have all the name.. so probably while writing it this post I found the solution?
let's try...
- DDavide Favargiotti @dieffe
Doh... I thought this:
var num = sf.ui.proTools.selectedTrackCount; var track = 'Untreated ' var trackName = [] for (var i =1; i-1 < num; i++){ trackName[i]= track + i.toString(); } sf.ui.proTools.trackSelectByName({names: trackName});
was the solution... but it's not. So.. I still need some help from anybody more skilled in coding :)
- In reply todieffe⬆:Christian Scheuer @chrscheuer2018-08-03 08:30:40.522Z
Hi @dieffe.
You were close.Since trackSelectByName can operate once on all the names, you just need to call that function once, with an array of the names.
To build up your array, you could do something like this:
var num = sf.ui.proTools.selectedTrackCount; var track = 'Untreated '; var names = []; //Create an empty array for (var i = 1; i - 1 < num; i++) { names.push(track + i.toString()); //Push the new name to the end of the array } sf.ui.proTools.trackSelectByName({ names: names, //Now pass the array to the action deselectOthers: true, });
- ?@anon6770933309
May I ask, how is this supposed to work?
- DDavide Favargiotti @dieffe
select multiple tracks, and the script selects the same number of tracks with specific names. (in this case untreated 1, untreated 2 etc)
I can use this script e.g. to copy material from some tracks to specific tracks (e.g. untreated)
Hope this makes sense.
- ?@anon6770933309
Thx for the clarification, Davide.
I tried it with tracks named "Untreated Audio 1", "Untreated Audio 2" etc. and it did not work. I tried it now with tracks named "Untreated 1", "Untreated 2" and didn't work either. It selects track "Untreated 1" only.
Is upper/lower case an issue?- DDavide Favargiotti @dieffe
Seems to work just fine in my system, with different naming schemes. You have to use the script from Christian, obviously, that's the one that works! :)
- ?@anon6770933309
Yep, I used Christian's, that won't work over here. Pro Tools Ultimate 2018.7, macOS 10.13.6.
- DDavide Favargiotti @dieffe
Did you add any track to your session? maybe try adding invalidate command at the beginning of the script?
sf.ui.proTools.mainWindow.invalidate();
- ?@anon6770933309
I am trying to run the exact code Christian has posted with nothing before or afterwards yet.
Christian Scheuer @chrscheuer2018-08-03 15:33:48.670Z
The suggestion to use invalidate actually would be my first trouble shooting step as well.
- ?@anon6770933309
AFAIK invalidate is the same as stop all running commands and restarting SF which I did.
But I tried what you suggested and addedsf.ui.proTools.mainWindow.invalidate();
And guess what? Its still not working.
Christian Scheuer @chrscheuer2018-08-03 16:11:31.880Z
@Oli_Em can you give more details then? Steps before, which tracks do you select prior, what do you expect to happen, what happens - regular bug report steps? It works flawlessly here.
Please remember, that what Davide is doing here is selecting the number of "Untreated " tracks that he has already selected. So if you've only one track selected, it will only select "Untreated 1". That was part of his intention with the script.- ?@anon6770933309
I am probably not getting the sense of this script, mea culpa.
"selecting the number of "Untreated " tracks that he has already selected." makes zero to none sense to me. 😜 Maybe I need a manual. Never mind Christian, its not that important to me.Christian Scheuer @chrscheuer2018-08-03 16:22:37.420Z
Haha you definitely need a manual! We all do.. Can't wait to hire that assistant to write it for me... haha.
Well Davide's workflow is as far as I can tell related to dialogue (and could be for sound effects too)
When you have some clips on lets say 3 adjacent tracks and you want to copy/paste or cut/paste those into new tracks, then for the paste operation you have to select the same number of tracks as you were copy/cutting from.
So if let's say you're copying clips from your 3 Boom tracks (Boom1 Boom2 Boom3) and you want that to go to the "Untreated *" tracks. But the script doesn't know if you selected 3 boom tracks or 5 or just 1. This script uses theselectedTrackCount
to know how many tracks are selected.
And then it selects the same number of "Untreated *" tracks, so it's ready to paste.At least that's what I think he's doing ;) Davide feel free to elaborate. And frankly, if you don't mind I think you're developing a workflow that would be ideally best explained in a video. Would be wonderful if you'd have the time to share at one point!
- DDavide Favargiotti @dieffe
Yep, Christian, that's exactly what I'm doing.
I also added a check so the script will notify me if it tries to copy something but there are already some regions in the destination tracks.
it's such a time saver, at least for me.I'll try to record a video during the weekend, if I have some time!
Christian Scheuer @chrscheuer2018-08-03 16:28:39.546Z
Wow @dieffe. Very very interested in that last part, where you're checking what's in the destination tracks!
I've wanted that for my own workflow for so long. Would you like to share your whole script in another post?Christian Scheuer @chrscheuer2018-08-03 16:29:56.794Z
Oh and didn't see you were ready for a video. That would be SO great. Don't mind about quality or anything. In my dream scenario, over the next few months we all from the beta group do some video recordings, to make it a little easier accessible to people why SF rocks ;)
I definitely need to do some as well.