Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Automatically set “Output to” to correct folder

  • Automatically set “Output to” to correct folder

  • Vahur Kuusk

    November 18, 2019 at 10:03 pm

    Hello,

    Is it possible to automatically set the output folder based to the location of the input footage?

    I have to do tons of preview mov’s from exr’s and I would like to eliminate the manual folder searching in output module. Instead I would like to press a button (using Kbar for example) and in render queue link it automatically to the input exr location on disk.
    Can this be done?

    Thanks.

  • Vahur Kuusk

    November 22, 2019 at 1:59 pm

    Here’s what I have now. It gets me to render queue with correct file name, however the folder is still messed up. When I press render AE says:
    “The directory originally specified in the selected output module no longer exists.”

    Clearly I’ve missed something. Any help is appreciated.

    var myComp = app.project.activeItem;
    var myFootage = app.project.item(1);
    var myFolder = myFootage.parentFolder.path;
    var rq = app.project.renderQueue;
    var render = rq.items.add(myComp);

    render.outputModules[1].file = new File(myFolder + "/" + myComp.name + "[DRAFT].mp4");

  • Dan Ebberts

    November 22, 2019 at 5:38 pm

    myFootage.parentFolder is going to give you the folder in AE’s project bin where the footage is located (probably the Root Folder if the footage is item 1). To get to the file system folder, you need to use myFootage.mainSource.path.

    Dan

  • Vahur Kuusk

    November 22, 2019 at 8:22 pm

    Thank you, Dan.

    For some reason, I still got an “directory does not exist” error when trying
    myFootage.mainSource.path;

    However I managed to solve it temporarily using file name substrings.

    This is not ideal, because I can only use it on this project, but if there is a way to make it not dependent on substrings, I am all ears.

    —-

    Also, why I had to set second item (2) for “myFootage” is beyond me, because in the project bin the footage is clearly first from top. But this is the only way I got the script to run. Weird.

    var myComp = app.project.activeItem;
    var myFootage = app.project.item(2);
    var myFolder = myFootage.mainSource.file;
    var myLoc = myFolder.path.substring(0,49);
    var rq = app.project.renderQueue;
    var render = rq.items.add(myComp);

    render.outputModules[1].file = new File(myLoc + "/" + myComp.name + ".mp4");
    app.project.renderQueue.render()

  • Tomas Bumbulevičius

    November 29, 2019 at 9:03 am

    Hey Vahur – how you are executing this script? By adding it directly into the KBar, or by linking external script file to be executed?

    Find out more:
    After Effects Tutorials: motion design, expressions, scripting.
    Boxer – Dynamic Text Boxes Template with a Live Preview

  • Vahur Kuusk

    November 29, 2019 at 9:09 am

    I am adding it directly into the Kbar as a scriptlet. I press the custom button and it start rendering.

  • Tomas Bumbulevičius

    November 29, 2019 at 9:23 am

    When you get location of a file, use ‘parent’ to get a folder location without working with strings.

    You might need to ‘convert’ result to .toString() in order to pass the folder path as a proper type, but this will eliminate a custom need of strings processing anyways.

    myFolder.parent;

    Find out more:
    After Effects Tutorials: motion design, expressions, scripting.
    Boxer – Dynamic Text Boxes Template with a Live Preview

  • Vahur Kuusk

    December 1, 2019 at 5:06 pm

    Thank you Tomas, that worked perfectly.
    .toString() is what I missed.

Viewing 1 - 8 of 8 posts

Log in to reply.

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