ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Adding folder items to a comp

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Michael Gaynor
Adding folder items to a comp
on Aug 13, 2015 at 9:27:38 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]);
}


Return to posts index

Dan Ebberts
Re: Adding folder items to a comp
on Aug 14, 2015 at 3:12:30 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



Return to posts index

Michael Gaynor
Re: Adding folder items to a comp
on Aug 14, 2015 at 11:01:16 pm

Awesome, I'll give that a shot.

Thanks Dan you're the man.

-Mike


Return to posts index


Danyl Bernard
Re: Adding folder items to a comp
on Jun 29, 2020 at 7:00:19 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?


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2020 CreativeCOW.net All Rights Reserved
[TOP]