Applescrip AERender dropper app

All things .jsx

Moderator: Paul Tuersley

Post Reply
scribling
Posts: 143
Joined: May 1st, 2005, 1:52 pm

I've written a simple Applescript that allows an AE project to be dropped on the icon and rendered in the Terminal.

This script is only tested under OSX.

Enjoy!


AERender_Dropper_v1.1
User avatar
aschmitt
Posts: 1
Joined: June 20th, 2007, 4:02 pm
Location: Rochester, NY

I just figured out that AE renders could be run at the command line without running AE (duh) yet I bear the twin curses of poor short term memory and deficient typing skills. Understandably I was excited to see someone had whipped up a nifty little front end to cure what ails me. Thanks for that Gregory.

Sadly it's probably non-functional for any user with bash as their shell instead of tcsh. As I understand it, the syntax for playing nice differs enough between the two shells to break the shell-script portion of your AppleScript for those people ("nice +[X]" vs. "nice -n [X]"). Unfortunately, Apple changed the default new user shell from tcsh to bash with OS X 10.3, so potentially you've a lot of broken people : (

A simple workaround (pretty much cribbed from Lloyd Alvarez's BG Renderer) is to be more deliberate and force terminal to use tcsh for just this instance regardless of the user's set preference. For tcsh users this is harmlessly redundant – bash users however are saved from failure. Kinda like so:

Code: Select all

do script "/bin/tcsh -c \"nice +10 '/Applications/Adobe After Effects 7.0/aerender' -sound ON -mem_usage 60 100 -project \"" & quoted form of mypath
or conversely, one could force bash:

Code: Select all

do script "/bin/bash -c \"nice -n 10 '/Applications/Adobe After Effects 7.0/aerender' -sound ON -mem_usage 60 100 -project \"" & quoted form of mypath
Cheers,
Andy
i can has cheezburger?
User avatar
lloydalvarez
Enhancement master
Posts: 460
Joined: June 17th, 2004, 9:27 am
Location: New York City, NY
Contact:

You like that one Andy?? That was a few days of figuring out why some people had problems and not others and then a bit of unix research to figure out how to switch the terminal temporarily to tcsh so as to not mess with the user's prefs. The reason I went with tcsh instead of bash is because 10.3 doesnt have bash and didnt want it to break. So far I have not seen a downside to using tcsh instead of bash.

-Lloyd
scribling
Posts: 143
Joined: May 1st, 2005, 1:52 pm

I duplicated the "do script" lines to create more instances of the render. I'm usually working on a quad so I set it create 3 instances.

Code: Select all

do script "/bin/tcsh -c \"nice +10 '/Applications/Adobe After Effects 7.0/aerender' -sound ON -mem_usage 60 100 -project \"" & quoted form of mypath
		do script "/bin/tcsh -c \"nice +10 '/Applications/Adobe After Effects 7.0/aerender' -sound ON -mem_usage 60 100 -project \"" & quoted form of mypath
		do script "/bin/tcsh -c \"nice +10 '/Applications/Adobe After Effects 7.0/aerender' -sound ON -mem_usage 60 100 -project \"" & quoted form of mypath
I've been using this script a lot. Don't know how I got along without it ...
stib
Posts: 21
Joined: December 10th, 2006, 10:23 pm
Contact:

You can make it use multiple processors with an -mp switch in the command line.

I have a similar applescript, it's a bit more interactive, at the expense of being more complicated. Mine will either take a dropped file or if you run it will ask for a file. I also made it shut the computer down after renders if the user chooses.

Code: Select all

--AErender utitlity with some bells and moderate whistles

property AEpath : "/Applications/Adobe\\ After\\ Effects\\ CS4/aerender" --path to your version of AErender, with escaped escaped spaces. Yours should look like this unless you've done something funky with your install.
property domultiprocessors : true --whether to use separate processors to render multiple frames at once
property shutdownscript : "~/Library/scripts/shutdownnow.app" --path to the shutdown script

set theproject to choose file with prompt "choose a file to send to AErender" of type {"EggP"} --why EggP? thats AEP files..

on open (theproject) --this happens if someone drops a file on this script
	tell application "Finder"
		set isAEP to (kind of item theproject is "After Effects Project")
	end tell
	if isAEP then
		render(theproject)
	else
		display dialog "I can't render this file" buttons {"choose again", "Cancel"} default button 1
		set theproject to choose file with prompt "choose a file to send to AErender" of type {"EggP"} --why EggP? thats AEP files
	end if
end open

on render(theproject)
	set thepath to quoted form of (POSIX path of theproject)
	set mpswitch to ""
	if domultiprocessors then set mpswitch to "-mp" --add the multiprocessor switch to the command line
	set shutdownatend to (button returned of (display dialog "shutdown after render?" buttons {"Yes", "No", "Cancel"} default button 2)) is "Yes"
	
	tell application "Terminal" --we want the terminal window open
		if shutdownatend then
			do script (AEpath & mpswitch & " -project " & thepath & "; open " & shutdownscript) as string
		else
			do script (AEpath & mpswitch & " -project " & thepath) as string
		end if
	end tell
end render
the shutdown script that I use to shut it down is:

Code: Select all

--shutdown script. Logs its own use.

property howlong : 60 --how long to wait for user response
property armed : true -- stops it actually shutting down if set to false - good for debug

try
	set lastshutdown to (do shell script "defaults read org.pureandapplied.shutdownnow \"last shutdown\"")
on error --if the key doesn't exist it chucks an error
	set lastshutdown to "never"
end try
try
	set useraction to (do shell script "defaults read org.pureandapplied.shutdownnow \"user action\"")
on error
	set useraction to "nothing"
end try
set reallySD to (display dialog ("I'm shutting down now." & return & "You have " & howlong & " seconds to stop me." & return & return & "The last time this script ran was at:" & return & lastshutdown & return & return & "the user action was" & return & useraction) as string giving up after howlong buttons {"Shutdown", "No don't!!"} default button 2 with icon caution)

set thedate to current date

if (button returned of reallySD is "Shutdown") or (gave up of reallySD) then
	if gave up of reallySD then
		set useraction to "no user response, so I shut down"
	else
		set useraction to ("user clicked " & button returned of reallySD) as string
	end if
	makelog(thedate, useraction)
	if armed then
		tell application "System Events"
			shut down
		end tell
	end if
else
	set useraction to ("user clicked " & button returned of reallySD) as string
	makelog(thedate, useraction)
end if
this needs to be compiled as an app and go in your home folder in the /library/scripts/ folder
scribling
Posts: 143
Joined: May 1st, 2005, 1:52 pm

I tried this script with CS5 and it didn't work.

1. It didn't recognize the .aep files as AE files;
2. The -mp flag makes AErender fail before launch.

I altered it to it's bare bones until it did work.
Post Reply