Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions duplicator script…undefined error

  • duplicator script…undefined error

    Posted by Tristan Cossins on April 28, 2014 at 10:31 pm

    Hey there Dan, or anyone that can help!

    I have the following code in my script, but am getting an undefined error in the following line:
    (note the script works perfectly after I hit ok… the error is annoying but!)

    ———

    var myComp = app.project.activeItem;
    var myLayers = myComp.selectedLayers;

    for ( var i = 0 ; i <= myLayers.length ; i++){

    var curLayers = myLayers[i];
    var myNewLayers = curLayers.duplicate();

    ———

    I need the duplicates to have a separate reference as i re-arrange the curLayers using the moveBefore and then the myNewLayers with the moveAfter commands (I create a solid in between).

    Any help would be great as I only started looking at coding a couple of days ago.

    Thanks a lot

    Tristan Cossins replied 12 years, 4 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    April 28, 2014 at 10:53 pm

    Try changing:

    i <= myLayers.length

    to:

    i < myLayers.length

    Dan

  • Tristan Cossins

    April 28, 2014 at 10:55 pm

    you are a legend… thanks so much Dan, works perfect.

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