Open louwjlabuschagne opened 3 years ago
Yes you can, using the following:
// Get video tracks
videoTracks = app.project.activeSequence.videoTracks;
// Loop through video tracks
for (i = 0; i < videoTracks.numTracks; i++) {
// videoTracks[i].setMute(1);
// videoTracks[i].setTargeted(true, true);
// videoTracks[i].setLocked(1);
}
Check out the video below to see it in action:
There are some subtleties with these methods... As you'll see, some of them take a boolean (true/false) and some an integer (1/0). This is what the API requires and there isn't much we can do about it, unfortunately. Usually what I do is try the one approach, i.e. boolean, and if I get the following error:
Try the other approach.
You'll see in the YouTube video I was using mute with a boolean, but in the video, in this comment, I'm using an integer. That's because in the YouTube video I was still running PP2020 (v14), and now I'm on PP2021 (v15) and it appears that the API has changed.
Keep in mind, you might not even notice this on your setup as Extendscript on certain machines will do the conversion for you, i.e boolean to integer and vice versa, so false will become 0 and true will become 1.
Another small thing to note is for the setTargeted
method you'll see there are 2 arguments, the first one is the state you want to track to go to, the second is whether you want the GUI to refresh, i.e. show the change in PP. I can't think of a time when you wouldn't want to do it, so I advice keeping the second argument always set to true.
Code snippet in repo here.
On https://www.youtube.com/watch?v=LGabsGWvrUY&lc=Ugz9jNsycJ-lg9g7ql54AaABAg