Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Add a custom solid to a selected comp in the project panel

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

    Posted by Hamid Rohi-bilverdy on June 14, 2015 at 12:46 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

    Walter Soyka replied 10 years, 10 months ago 2 Members · 2 Replies
  • 2 Replies
  • Hamid Rohi-bilverdy

    June 15, 2015 at 8:42 am

    Anyone???

  • Walter Soyka

    June 15, 2015 at 2:11 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   |   RenderBreak [blog]   |   Profile [LinkedIn]

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy