From: Greg Ercolano <erco@(email surpressed)>
Subject: [Q+A] After Effects: Is there a way to open the Rush submit form
   Date: Thu, 07 Jul 2011 17:38:55 -0400
Msg# 2113
View Complete Thread (2 articles) | All Threads
Last Next
> Is there a way to open the 'submit-afterfx' form from within
> the Mac OSX version of After Effects? (We're using CS5)
>
> We'd like it so that the submit form opens with the Scene File,
> Frames, Comp Name, etc. all preset, so that in most cases
> the user can just hit 'Submit' to submit the job without filling
> out any of the fields.

    Yes; many folks have been writing their own AE scripts to
    do this.

    Here's one that Simon Bjork and I have worked together on.

    To install it:

       1) Save the below script as 'Rush.jsx' in the 'Scripts' directory
          of Adobe After Effects. So for example: OSX with AE CS5, save it as:

          /Applications/Adobe After Effects CS5/Scripts/Rush.jsx

          (Make sure your newsreader doesn't line-wrap the script;
          make your reader window as wide as possible before copy/pasting!)

       2) Customize the settings at the top of the script for your
          network (eg. the section "USER VARIABLES: CHANGE THESE!!!")
          At very least, you'll need to change this setting:

          var SCRIPT = "/your/server/rushscripts/submit-afterfx.pl";    // path to submit-afterfx.pl on your server
                        ------------------------------------------

          ..to be the path to the submit-afterfx.pl script that is
          on your file server.

    To use this script:

       1) Run After Effects.

       2) Load a scene file that you want to render,
          and optionally make changes as needed.

       3) When you want to render the scene,
          go into the AE menubar to run the new Rush.jsx script:

              File > Scripts > Rush.jsx

	  This will open the submit-afterfx.pl form with the currently
          loaded scene file, frame range, and comp.

     Feel free to modify the script to taste.
     Some of the code is optional, eg. forcing the Cpus: to a certain value,
     setting the Job Title (normally the script does this if you leave
     the title blank).

     Be sure to make the minimum modifications described above,
     otherwise the submit form won't open at all.

     This script should work in all Mac versions of AE
     from 6.5 on up to CS5, and beyond. 
     
     UPDATE 11/02/2012
     ***********************************************************************************************************
     *  In CS5 Adobe actually did change their API; for versions of AE
     *  CS5 and up, you'll get the following error with the script as it's
     *  written below:
     *
     *     Unable to execute script at line 50.  TimecodeDisplayType is undefined 
     *
     *  To fix that error, change this line:
     *
     *      app.project.timecodeDisplayType = TimecodeDisplayType.FRAMES; // Sets time code display to frames.
     *
     *  ..either comment that line out (it's not critical to how the script
     *  executes), or replace it with:
     *
     *      app.project.timeDisplayType = TimeDisplayType.FRAMES;         // Sets time code display to frames.
     ***********************************************************************************************************

     As written, the script is OSX oriented, but it can be modified
     to work under Windows as well if you modify the "> /dev/null"
     lines accordingly. I, or possibly someone else here can follow up
     with a version that works for both OSX and Windows. (The trick is
     to make sure the submit form doesn't freeze up the AE interface).

     What follows is the Rush.jsx script:

///////////////////////////////////////////////////////////////////////
// Rush.jsx
//
// This script brings up the submit-afterfx interface from within AfterFX
// with the values for scene file, frame range, compname, etc. preset in the form.
//
// To install, save this script as "/Applications/Adobe After Effects/Scripts/Rush.jsx"
// It will then automatically show up in the Files -> Scripts menu of AE.
//
// TODO: Currently supports Mac OSX only. Should be modified to support Windows.
//
// by Simon Bjork with the help of Greg Ercolano.
// Based on a Nuke script by Greg Ercolano.
//
// February 2011. Version 1.4 -- Simon Bjork and Greg Ercolano
// July 2011.     Version 1.5 -- Greg Ercolano -- added check if no scene loaded, code cleanup
//
///////////////////////////////////////////////////////////////////////


//// USER VARIABLES: CHANGE THESE!!!

// CUSTOMIZE THIS PATHNAME FOR YOUR ENVIRONMENT
//                      |
//                     \|/
//                      v
var SCRIPT = "/your/server/rushscripts/submit-afterfx.pl";    // path to submit-afterfx.pl on your server
var CPUS   = "+any=5@100";                                    // default cpu specification
var BATCH  = 5;                                               // default frame batching value

////////////////////////////////////


// See if scene file is loaded
if ( ! app.project.file ) {

    // No scene file loaded? Just open default submit form
    alert("No scene file loaded.\n" +
          "Using previously rendered submit defaults.");

    // Run submit script with no arguments. Assume defaults from last submit.
    var cmd = "perl " + SCRIPT + " " + " > /dev/null 2>&1 < /dev/null &";
    var out = system.callSystem(cmd);

} else {

    // Scene file loaded? Get scene filename, frame range, comp name, etc.
    var mycomp = app.project.activeItem;                          // The comp to be submitted.
    var projectPath = app.project.file.fsName.toString();         // Path of current AE project file.
    app.project.timecodeDisplayType = TimecodeDisplayType.FRAMES; // Sets time code display to frames.

    // Start and End frames of workarea in frames.
    var wa_start = mycomp.workAreaStart;
    var wa_end = mycomp.workAreaDuration + wa_start;
    var sfrm = timeToCurrentFormat(wa_start, mycomp.frameRate, false);
    var efrm = timeToCurrentFormat(wa_end,   mycomp.frameRate, false);
    sfrm = parseFloat(sfrm);
    efrm = parseFloat(efrm);

    // Name of AE project file and remove .aep extension.
    var aeproj        = app.project.file.name.replace(/%20/gi," ");
    var aeproj_no_ext = aeproj.substring(0,aeproj.length-4);
    var jobtitle      = aeproj_no_ext;
    var compname      = mycomp.name;

    // Run submit script
    var cmd = "perl " + SCRIPT + " " +
                    "-field JobTitle: "     + jobtitle          + " " +
                    "-field Frames: "       + sfrm + "-" + efrm + " " +
                    "-field ScenePath: "    + projectPath       + " " +
                    "-field CompName: \""   + compname          + "\" " +
                    "-field BatchFrames: "  + BATCH             + " " +
                    "-field Cpus: \""       + CPUS              + "\" " +
                    " > /dev/null 2>&1 < /dev/null &";
    var out = system.callSystem(cmd);
}
/// END: Rush.jsx

Last Next