Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Adding folder items to a comp

  • Adding folder items to a comp

    Posted by Michael Gaynor on August 13, 2015 at 9:27 pm

    Hi,

    I have a folder in my project with some footage imported by my script, and I would like to add that footage to a comp that has already been created called “myComp”. Trying to loop through the folder items as an array and add them to the comp that way, but my code doesn’t seem to be working. Can someone point out what I am doing wrong? Thanks in advance!!

    var folderItems = targetFolder.getFiles();
    for (var i = 0; i <folderItems.length; i++) {
    myComp.layers.add(folderItems[i]);
    }

    Danyl Bernard replied 5 years, 10 months ago 3 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    August 14, 2015 at 3:12 am

    getFiles() works with disk-based folders, not project bin folders. I think you’ll need to go through all the items, collecting any FootageItem where theItem.parentFolder.id == targetFolder.id .

    There may be other ways to do it, but I think that’s how I’d do it.

    Dan

  • Michael Gaynor

    August 14, 2015 at 11:01 pm

    Awesome, I’ll give that a shot.

    Thanks Dan you’re the man.

    -Mike

  • Danyl Bernard

    June 29, 2020 at 7:00 am

    Hey, I’m about a half a decade late to the party.

    Can someone please explain Dan’s solution? I’m trying to create a script where a folder is selected in the project panel, and all of its contents are added to a main composition in the project. how would I go about doing that?

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