Creative Communities of the World Forums

The peer to peer support community for media production professionals.

  • Array help

  • Chris Korangy

    July 24, 2021 at 5:45 pm

    Hi all,

    I’m having a go writing my first script but I can’t seem to wrap my head around why this isn’t working. I have 12 items in my project folder and 12 items in this array. What I’d like is for the first item to duplicate by the first number of the array (duplicate 3 times), then the second item to duplicate by the number in the 2nd array etc.

    What am I missing? any help much appreciated!

    myArray = [3,2,5,3,6,9,7,6,5,7,5,6];

    for(i=1; i<=app.project.numItems; i++){

    var curComp = app.project.item(i);

    var curDup = myArray[i];

    for(d=1; d<=curDup; d++){

    curComp.duplicate()

    }

    }

  • Dan Ebberts

    July 24, 2021 at 6:00 pm

    I think the main thing is that you’re trying to loop through the project items while you’re adding items. Without knowing how you have things set up, I’d guess you should probably first put all the comps you want to duplicate into an array and then loop through that.

  • Chris Korangy

    July 24, 2021 at 7:18 pm

    Ah yes I see, that makes sense now. I will give that a go, thanks Dan

Viewing 1 - 3 of 3 posts

Log in to reply.

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