Copy link to clipboard
Copied
Hi
I cant figure this one out. I really am the phase of learning the wonderfull world of after effect scripting.
I am trying to do a script where i add a custom solid to a selected comp in the project panel. Also do a check to see if a comp is selected.
Here below is my poor attempt.
app.beginUndoGroup("Add solid");
var curItem = app.project.activeItems;
//Check if is a comp is selected
if(curItem == null || !(curItem instanceof CompItem)) {
alert("Please select a comp");
}else{
alert("You have selected a comp");
curItem.items.addSolid([0.5,0.5,0.5], "My Gray Solid", 1920, 1080, 1.0, 5);
}
app.endUndoGroup();
Please advice...
/HRB
Copy link to clipboard
Copied
It is
app.project.activeItem
not
app.project.activeItems
and
curItem.layers.addSolid
instead of
curItem.items.addSolid
Copy link to clipboard
Copied
Thank you Mathias.