Copy link to clipboard
Copied
What I am trying to do is access information through scripting such as files that have been imported into the project. Is there any way to open up after effects in a non-gui mode the way nuke can be opened in terminal mode?
Copy link to clipboard
Copied
I would like to know this too.
Copy link to clipboard
Copied
In windows, you can call AE from the command line like so:
afterfx -noui
The -noui switch tells the afterfx executable to stop the GUI from launching with it.
Copy link to clipboard
Copied
The -noui argument seems to work in OSX as well. I'm having difficulty getting AE to launch/run a script via the command line though (on OSX)
Copy link to clipboard
Copied
I haven't done much automation with AE on OSX. I recall reading somewhere that AppleScript may be the answer to starting it on OSX. If you find out more about launching AE via command line in OSX, please post back. I'd also like to know.
Copy link to clipboard
Copied
I suspect Apple script will be required as well. I am able to drop a .scpt file onto the AE.app in the Finder, it launches & executes the script. Let me see if I can dig up a command line way to make this happen in conjunction with the -noui argument. My current workaround is to add the script to the AE scripts startup folder, launch AE with the -noui argument, then delete script. This is of course very hacky so I would prefer something more straight forward.
I'll post back the results!
-Andy
Copy link to clipboard
Copied
Just so its written somewhere out on the intertubes, since I had a great deal of difficulty tracking this down:
#this command will launch AE in Render Engine mode, w/o a ui
open -n -a 'Adobe After Effects CS5.5.app' --args -re -noui
#this command will launch AE in Render Engine mode, with a ui
open -n -a 'Adobe After Effects CS5.5.app' --args -re
#this command will launch AE in normal/interactive mode, w/o a ui
open -n -a 'Adobe After Effects CS5.5.app' --args -noui
#this launches AE w/o a UI, but the script never runs
open -n -a 'Adobe After Effects CS5.5.app' --args -noui -s 'alert(1)'
#this launches AE with a UI, but the script never runs
open -n -a 'Adobe After Effects CS5.5.app' --args -s 'alert(1)'
#this launches AE with a UI, but does not execute the script (scripts contents is alert("hello world!");)
open -n -a 'Adobe After Effects CS5.5.app' --args -r /path/to/script/helloWorld.jsx
I got the -r and -s arguments from this doc, page 5:
http://blogs.adobe.com/toddkopriva/files/2012/06/After-Effects-CS6-Scripting-Guide.pdf
Too bad, I would really like to use the -s and -r arguments, on OSX.
This also does not work:
open -n -a 'Adobe After Effects CS5.5.app' --args /path/to/script/helloWorld.jsx
I get an error from After Effects that says "After Effects error: Can't import file "helloWorld.jsx": unsupported filetype or extension. ( 0 :: 1 )"
I was incorrect earlier saying that dragging a .scpt file will launch it on AE... I think I had a sinapse misfire or something.
Dropping a .jsx file onto AE from the finder results in the same error.
Copy link to clipboard
Copied
Okay, got this working.
Here is the content for the applescript:
set theFile to "/path/to/script/helloWorld.jsx"
open for access theFile
set fileContents to (read theFile)
close access theFile
tell application "Adobe After Effects CS5.5"
DoScript fileContents
end tell
And here is how you launch it from the command line:
osascript /path/to/apple/script/ae_55_runJsx.scpt
If AE is not up and running, the apple script will cause it to launch.
If you launch AE using the -noui argument, then run the osascript, the script does run (I get the hello world! popup from AE):
open -n -a 'Adobe After Effects CS5.5.app' --args -noui
osascript /path/to/apple/script/ae_55_runJsx.scpt
Hope this helps others in the future.
Does this feel incredibly convoluted to anyone else?
I've written plenty of compiled code in my days, and I never found it challenging to add/parse command line arguments.
Is there a specific reason the -r and -s input arguments do not work with After Effects on OSX?
Copy link to clipboard
Copied
I agree it's convoluted, but I definitely appreciate you posting your solution. It's very useful information and should probably be documented by Adobe's AE team.
Copy link to clipboard
Copied
Thank you for posting this solution. You saved me tearing all my hair out after following the examples on page 6 of the scripting guide (CS6) and them not working. Plabt, please update the second example (running a jsx file via AppleScript) to work as described above. The current example doesn't work:
set theFile to choose file
tell application "Adobe After Effects CS6"
DoScript theFile
end tell
Thanks!
Copy link to clipboard
Copied
No problemo.
After posting this info, I figured out that it is possible to modify the commandLineRenderer.jsx script (check the scripts/startup/ folder for it). My custom version has an extra input argument which I pass a jsx script to. The jsx file contents are read, then evaluated. This basically allows for using After Effects as a generalized image processing tool. (or prores 4444 movie maker.) I'm not going to post the code since the commandLineRenderer.jsx file is Adobe's property. One major limitation to this, if you try to save out an .aep file in the process, it will be corrupt. I think this is a sort of copy protection or something on Adobe's part so people don't buy just one copy of AE and try to use it multiple times. Make a copy of the commandLineRenderer.jsx file before messing with it! This is working with CS 5.5, I havent tried it with 6.0 yet but I assume it will work fine. Also, no matter how hard I try, I can't get it to run 'silently' in this way... IE: it always makes the "ding" sound when a comp completes rendering.
One note about launching AE via the AppleScript, it isn't always successful. If you try to load a large AEP file, with lots of source media or whatever, AE will be in a state where it doesn't receive the JSX contents that the AppleScript sent it. I ended up going the route I described w/ modifying the command line renderer, so I never needed to solve this. Perhaps an sleep event or some sort of communication back to the AppleScript would be useful to ensure success.
Best of luck!
Message was edited by: Andyways, typos, grammer.
Copy link to clipboard
Copied
Well after much googling, it turns out that the documentation in the AE Scripting Guide is incorrect for running a script file on OSX. The PDF for CS3 and CS6 document the following in Applescript:
set theFile to choose file
tell application "Adobe After Effects CS3"
DoScript theFile
end tell
As Christian Lett points out, this example does not work. However, after finding this little tie bit on the inter webs over at Stack Overflow, this actually does work:
set theFile to choose file
tell application "Adobe After Effects CS3"
DoScriptFile theFile
end tell
So the difference is that you must use `DoScriptFile` rather than simply `DoScript`. I think this will get around the limitation that Andyways mentions about large AEP files not being able to execute the script properly.
Hope that helps!
Copy link to clipboard
Copied
I've been using LuminousRender for Mac ... works great