On 07/07/11 14:38, Greg Ercolano wrote:
>> Is there a way to open the 'submit-afterfx' form from within After Effects?
>
> Feel free to modify the script to taste.
> What follows is the Rush.jsx script:
[This is kinda old -- noticed I never posted this update for cs5, so posting it now -erco]
Adobe changed their API in CS5 which caused the previous script
to fail with this error message:
Unable to execute script at line XX. TimecodeDisplayType is undefined
..so you would want to use this script instead for CS5 and up:
///////////////////////////////////////////////////////////////////////
// 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
// November 2012 Version 1.6 -- Greg Ercolano -- CS5: changed TimecodeDisplayType -> timeDisplayType, etc
//
///////////////////////////////////////////////////////////////////////
//// 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.timeDisplayType = TimeDisplayType.FRAMES; // Sets time display to use 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
|