Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Moving a comp into an existing folder in the project window via script

  • Moving a comp into an existing folder in the project window via script

    Posted by Sergio Pol on January 4, 2015 at 9:43 pm

    Hello I created a script that imports a project into another. I need to keep the project window as tidy as possible for the script to work every time. I’m avoiding error checking since I don’t have that kind of knowledge yet. So imagine you have an open project and you import one via script. you end up with a new folder named after the imported project with its content inside. Well I need to move the content of that new folder, which consists only of a single comp, to an existing one in the main project window (it’s called “COMP” folder) and then delete the empty folder (the one created at import). I hope I was clear enough, thanks.

    Sergio Pol replied 11 years, 4 months ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    January 4, 2015 at 11:44 pm

    The script will need to know something that is unique about that comp. Will it always have the same name? Or will it be the only comp that isn\’t already in the \”COMP\” folder?

    Also, does the script create the COMP folder, or will it already be there?

    Dan

  • Sergio Pol

    January 4, 2015 at 11:57 pm

    Yes and yes. In my active project will always exist that “COMP” folder. And that new comp will always be named “01_textosWow”. It’ll be imported via the script by asking the user to locate the project file.

    I guess I misunderstood your question Dan. In the active project there will always be a COMP folder. Inside that folder there will be other content already. The new comp will always be “01_textosWow” I’ll need to move that imported comp into the existing COMP folder and then delete the “01_textosWow.aep” folder that is created after the import.

  • Dan Ebberts

    January 5, 2015 at 12:09 am

    I think this is everything except deleting the project folder, but it should give you the idea:


    function example(){

    // find COMP folder

    var compFolder = null;
    for (var i = 1; i <= app.project.numItems; i++){
    if ((app.project.item(i) instanceof FolderItem) && (app.project.item(i).name == "COMP")){
    compFolder = app.project.item(i);
    break;
    }
    }

    if (compFolder == null) return;

    // find comp

    var projectComp = null;
    for (var i = 1; i <= app.project.numItems; i++){
    if ((app.project.item(i) instanceof CompItem) && (app.project.item(i).name == "01_textosWow")){
    projectComp = app.project.item(i);
    break;
    }
    }

    if (projectComp != null){
    projectComp.parentFolder = compFolder;
    }

    }
    example();

    Dan

  • Sergio Pol

    January 5, 2015 at 3:46 am

    Thanks a lot for always taking time to share your skills and help others Dan.

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