Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Extendscript: Add solids to a comp

  • Extendscript: Add solids to a comp

    Posted by Hamid Rohi-bilverdy on June 16, 2015 at 7:30 pm

    Hi

    My code below dont generate any solids from my array into a comp.

    Basicly I want to add 2 solids with specifik names from an array, into comp number 1. But nothing happends.. Any thoughs??

    app.beginUndoGroup("add 2 solids");

    var proj = app.project;
    var mySolids = new Array("SolidOne","SolidTwo");
    var numSolids = mySolids.lenght;

    for(var i=0; i <= numSolids; i++ ){
    proj.item(1).layers.addSolid([0.5, 0.5, 0.5], mySolids[i], 1920, 1080, 1.0, 5);
    }

    app.endUndoGroup();

    Hamid Rohi-bilverdy replied 10 years, 10 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    June 16, 2015 at 7:52 pm

    You had a couple of typos. This seems to work:


    app.beginUndoGroup("add 2 solids");

    var proj = app.project;
    var mySolids = new Array("SolidOne","SolidTwo");
    var numSolids = mySolids.length;

    for(var i=0; i < numSolids; i++ ){
    proj.item(1).layers.addSolid([0.5, 0.5, 0.5], mySolids[i], 1920, 1080, 1.0, 5);
    }

    app.endUndoGroup();

    Dan

  • Hamid Rohi-bilverdy

    June 16, 2015 at 8:31 pm

    Thank you Dan… Works perfectly.

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