-
applescript: executing a jsx in after effects
Hey again,
it seems i am not the only person having trouble getting scripts to run via applescript, so i thought i would present my case here. I have the following script that i want to run after the aerender application has been executed from the terminal and finished rendering:
var report = new File ("Macintosh HD/Users/macname/generallog.txt");report.open("r");
var reportstring = report.read();
report.close();
var reportendindex = reportstring.indexOf("Total Time Elapsed:");
var reportcloseindex = reportstring.indexOf("aerender version");
var reportendstring = reportstring.substring(reportendindex, [reportcloseindex]);var regex = /Finished composition/gi, result, indices = [];
while ( (result = regex.exec(reportstring)) ) {
indices.push(result.index);
}var ItemStringArray = new Array ();
for(var i=0; i
This is basically compiling a list of date information from a log file for each finished item in the render queue after they have been rendered by aerender and notifies the user with that info that aerender is completed.
This script is being executed in the following way:
First, a script initiates the aerender process by passing commands to the terminal. One command at the very end triggers the above notification script by running an applescript called "TerminalReply.scpt":
system.callSystem('osascript -e 'tell application "Terminal" to do script ["command /Applications/Adobe\\ After\\ Effects\\ CS5.5/aerender -project /Users/ikono25/projects/code/RenderReportTest_2.aep> generallog.txt;osascript /Applications/Adobe\\ After\\ Effects\\ CS5.5/Scripts/TerminalReply.scpt"]'');The code within this TerminalReply.scpt is the following:
set scriptfile to (POSIX file ("/Applications/Adobe After Effects CS5.5/Scripts/TerminalAntwort.jsx"))
tell application "Adobe After Effects CS5.5"
DoScriptFile scriptfile
end tellThe script is being executed in after effects, but sadly in the wrong way. Let me explain:
The notification from the first script should contain information about the items rendered and the total render time. When i run the script manually from the toolkit, i get the correct infos alerted. When i run it over the terminal>applescript way, it only alerts "rendering done." without any additional info. The variables used to create the "AlertString" are empty when running the script via applescript.
I have tried some other solutions but none seem to work. The problem seems to be related to applescripts way of reading the contents or passing the jsx to after effects.
I really need some help here as to understand what the problems are because when automating aerender, there is no way of avoiding applescript and terminal as far as i can tell.