Activity › Forums › Adobe After Effects Expressions › Remove unnamed marks via script
-
Remove unnamed marks via script
Posted by Kina Sa on February 10, 2022 at 6:53 pmHello,
I use marks with and without text on Premiere.
Once in After Effect, I only need the markers with the text. Is it possible to delete only marks without text with a script?
Thanks
Kina Sa replied 4 years, 3 months ago 3 Members · 5 Replies -
5 Replies
-
Tomas Bumbulevičius
February 11, 2022 at 11:05 amHey Kina, yes.
You need to cycle through all markers, read the value of “comment” in the marker and if its empty – delete them.
The way how to access composition markers or layer markers is a bit different – thus let us know where the markers are (whether its at the top of composition or on a specific layer).
-
Andrei Popa
February 11, 2022 at 11:42 amAs Tomas said, there are 2 different approaches for layer/comp markers.
If the markers are on a layer, you can select it and run this snippet
var crtLayer = app.project.activeItem.selectedLayers[0];
var markers = crtLayer.marker;
for(var i = markers.numKeys; i>0; i--){
if(markers.keyValue(i).comment == "") markers.removeKey(i)
}If the markers are on the composition, select it or a layer inside it and run this snippet:
var crtComp = app.project.activeItem;
var markers = crtComp.markerProperty;
for(var i = markers.numKeys; i>0; i--){
if(markers.keyValue(i).comment == "") markers.removeKey(i)
} -
Tomas Bumbulevičius
February 11, 2022 at 2:41 pmAndrei – do you happen to know why they are different btw? As I always fail to remember which is which and have to dig through the resources, haha!
-
Andrei Popa
February 12, 2022 at 7:55 amAs far as I know, they are different because Adobe introduced the ability to access comp markers a few years later. The only big difference for us, the users, is that the markers for layers are accessed through layer.marker and the comp markers are accessed through comp.markerProperty. The result of these 2 calls is the same property type, so I assume we can treat them the same way.
Reply to this Discussion! Login or Sign Up