You can be more productive in After effects by concentrating on the design process rather than the organizing and folder creation process. If you are working on a long production, where you need to organize all your renders in appropriate places I thought I will share some Java-script that can help anyone looking for a fast folder creation solution.

What the below script will do is, assume you have a project name which has all the naming conventions and version names in it, if you want to create all the folders according to the naming conventions then it can be confusing quite often , so when you have a project and when you don’t have anything added on the render queue, if you just run this script it will add the composition into your render Queue and then create appropriate folders on the disk (The project location should be mentioned in the script ) and the project will also be named with the appropriate version number. You just have to press the render button !!!!! No need to worry about where the frames are going, everything will be organised .

In the below script , to make it more generalistic , I have added comments so that you can modify it according to how you want it. If you have any trouble just leave a comment.

// First get the project path and get all the groups inside it using Regex

var myPath = app.project.file.toString();
//alert( myPath);
// FOR MAC
var myRegexp = "Put your location here "
// example   -------     /folder/user/aftereffects/projectName.aep

var match = myRegexp.exec(myPath);
alert(myPath); 
// USe the below variables to match all the naming conventions from your regex code 
var fullPath = match[0];
var projectName = match[1];
var carName = match[2];
var shotName = match[3];
var sceneName = match[6];
var versionName = match[7];

var verNum = parseInt( versionName );

var s = "000" + verNum;

// Add the current comp to the render queue
var theComp = app.project.activeItem ;
cineonRQ = app.project.renderQueue.items.add(theComp);

// grab the output module
var cineonOM = cineonRQ.outputModules[1];

//Apply the template to the output module, you can add any template that you have created
cineonOM.applyTemplate("___EXR");

//Create a new path using all the info above and also create
// all the necessary folders

var projectPathParent = myPath.substring(0, myPath.lastIndexOf("COMP"));
var renderFolder = "Any name"
var compType = sceneName;
var versionNum = versionName ;
newPath = projectPathParent + renderFolder+ "/" ;
//Folder(newPath).create();
newPath += compType+ "/" ;
Folder(newPath).create();
newPath += "v"+versionNum + "/" ;
Folder(newPath).create();

// APPLY NEW PATH/NAME

newPath += "project_"+match[3]+"_comp_"+sceneName+"_version name "+match[7]+ ".\[####\].exr";
cineonOM.file = new File(newPath);

//alert(match[3]);  // Use this for debugging inside afetr effects

One Comment

  • smohan says:

    when i used the following code for creating new folder for the final renders in after effects, the script just stops.
    And does not work.
    Please help me.

    CODE

    Folder(newPath).create();

    Thanks
    Mohan

Leave a Reply