Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Adding a Folder through script

  • Adding a Folder through script

    Posted by Nathaniel Logan on October 27, 2018 at 6:09 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");

    Nathaniel Logan replied 7 years, 9 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    October 27, 2018 at 7:05 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

  • Nathaniel Logan

    October 28, 2018 at 11:53 am

    Thank you so much Dan,

    This works prefectly great.

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