Quantcast
Channel: Adobe Community : Discussion List - After Effects Scripting
Viewing all articles
Browse latest Browse all 2143

Loop through Comps and adding a layer causes problems

$
0
0

Hey Guys,

 

I am new to scripting for After Effects. Unfortunately i couldn't find a solution in the forum.

 

I've written a script that adds a null to all existing comps.

 

var proj = app.project;

var itemTotal = proj.numItems;

app.beginUndoGroup("Add Null")

for(var i = 1; i <= itemTotal; i++){

     var curItem = proj.item(i);

     if(curItem instanceof CompItem){

              //Add Null

               var newNull = curItem.layers.addNull();

     }

}

app.endUndoGroup()

 

Logically, the script creates a solid folder with the nulls, and this is my problem, the script ignores all comps that are now listed below this solid folder, but

works just fine for all comps above the created solid folder.

And when i have 3 comps named with a letter after the "S" the script puts 2 nulls in the first comp and ignores the other two comps.

 

Does anyone know how i can alter the script so it ignores the created solid folder and picks only the existing comps?

 

I tried several other ways, like items.length, but that also doesn't work.

 

I hope i made myself clear, english isn't my first langauge.

 

Thank you all very much in advance.

 

Best regards,

 

Marc

 

 

 

After Effects CC2018 & ExtendScript CC

Windows 10


Viewing all articles
Browse latest Browse all 2143

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>