Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects [AE extend script] add project item to activeComp and set custom startTime

  • [AE extend script] add project item to activeComp and set custom startTime

    Posted by Emid Rianta on October 20, 2020 at 7:08 am

    i have 3 “.wav” footages in project panel and i want to add the footages to active comp starting at time 1, 3, 5 (second)

    here’s what i got now

    var MyComp = app.project.activeItem;

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

    if ((app.project.item(z) instanceof FootageItem) && app.project.item(z).name.indexOf(“.wav”) != -1) {

    MyComp.layers.add(app.project.item(z)).startTime = ???

    }

    }

    any idea?

    Emid Rianta replied 5 years, 10 months ago 3 Members · 4 Replies
  • 4 Replies
  • Brendon Murphy

    October 20, 2020 at 5:35 pm

    Instead of trying to change the start time right away, you could add the wave files to an array and then assign the start time based on the array index (0,1,2) when you add them to the comp. OR, add all three items to the top of the comp without changing the start time. Then change the start time of the first three layers in the comp using layer indexes 0,1, and 2.

  • Emid Rianta

    October 21, 2020 at 9:28 am

    thanks for replying! could u write the code please? as I explained I need to drop those .wav footages at time 1, 3 and 5. so do i can use arrays to drop at those specific time? im so confused about looping an array as im new in javascript xD

  • Dan Ebberts

    October 21, 2020 at 4:01 pm

    Try it this way:

    var MyComp = app.project.activeItem;

    var count = 0;

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

    if ((app.project.item(z) instanceof FootageItem) && app.project.item(z).name.indexOf(".wav") != -1) {

    count++;

    MyComp.layers.add(app.project.item(z)).startTime = count*2-1;

    }

    }

  • Emid Rianta

    October 22, 2020 at 1:07 pm

    Dan you saved my day! Thank you!!

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