ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Add a custom solid to a selected comp in the project panel

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Hamid Rohi-BilverdyAdd a custom solid to a selected comp in the project panel
by on Jun 14, 2015 at 12:46:42 pm

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


Return to posts index

Hamid Rohi-BilverdyRe: Add a custom solid to a selected comp in the project panel
by on Jun 15, 2015 at 8:42:16 am

Anyone???


Return to posts index

Walter SoykaRe: Add a custom solid to a selected comp in the project panel
by on Jun 15, 2015 at 2:11:42 pm

[Hamid Rohi-Bilverdy] "var curItem = app.project.activeItems;"

This line is wrong. There is only one activeItem. It should read:

var curItem = app.project.activeItem;




[Hamid Rohi-Bilverdy] "curItem.items.addSolid([0.5,0.5,0.5], "My Gray Solid", 1920, 1080, 1.0, 5);"

This line is also wrong. addSolid() is a method of a layer collection, not an item collection:

curItem.layers.addSolid([0.5,0.5,0.5], "My Gray Solid", 1920, 1080, 1.0, 5);

Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]