ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Adding a Folder through script

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Vimal Kumar
Adding a Folder through script
on Oct 27, 2018 at 6:09:04 pm

Hi,
Im new to After effects Scripting, Im working on a office project, where Im trying to figure out that,

i am able to add a folder throught script, but if want to write a condition that if the folder already exists in the Project window it should not cleate the folder, as of there should not be another dupliate..

Can anyone help me on this, im really a newbie to scripting, pls help guys. =)

app.project.items.addFolder("Solids");


Return to posts index

Dan Ebberts
Re: Adding a Folder through script
on Oct 27, 2018 at 7:05:39 pm

Something like this maybe:


function getFolder(theName){
for (var i = 1; i <= app.project.numItems; i++){
if ((app.project.item(i) instanceof FolderItem) && (app.project.item(i).name == theName)){
return app.project.item(i);
}
}
return app.project.items.addFolder(theName);
}

var myFolder = getFolder("Solids");
alert (myFolder.name);



Dan



Return to posts index

Vimal Kumar
Re: Adding a Folder through script
on Oct 28, 2018 at 11:53:34 am

Thank you so much Dan,

This works prefectly great.


Return to posts index

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