March 26, 2004

Quick Tip: After Effects Java Script

So crazy it just might work.

You probably know about the new tools in Adobe After Effects 6. Topping the list of new features is Text, Paint, Tracking and some workflow enhancements (thanks Brian). There are some subtle features that you may not have looked at that offer some alternatives to how you work with After Effects. This week I'll look at the simple script that's already included with AE6 for controlling rendering.

Okay, this week, I wanted to show off a couple of hidden jems in AE6. The first trinket is the ability to email notification of a completed render.

First, a little review of the java neighborhood. Near the bottom of the "File" pulldown menu there is a section dedicated to the external scripting of After Effects processes. You're probably already familiar with a couple of the features there.

Collect Files

"Collect Files" is a commonly used script that looks through all of your mounted hard drives to find and deposit the media associated with your project into a single project folder. There are a couple of practices you may want to adopt if you use this feature regularly. First, make sure that you have a hierarchy of folders in your project that define the material you use. An example of a simple set of source manager folders might include spots for your graphic materials, another for video, one for rendered sequences (like 3D), precomps, and final compositions.

"Collect Files" will create subfolders based on the folders that you create in the project. I like to number my folders, so my Finals and Solids stay at the bottom when sorted alphabetically. Having a black and white solid handy is an Inferno* thing, but good to have in AE too.

Watch Folder

"Watch Folder" is a command that is used when setting up render engines across your network for a render farm. (Note: It should probably appear in the list above "Collect Files", but it is available only in the Professional version) You'll need to create a watch folder on a computer that is seen by all of the render stations. Then you dump the collected project folder into the "Watch Folder". The bloater about this is having to collect all of the sources - which if you're on a SAN solution, seems redundant. However, for long projects and several machines, it's well worth it. You can check the progress of the machines and renders through an HTML browser (similar to Maxon's Cinema4D Net Render).

Email & other scripts

NOW, appearing in the new slot below these two options is "Run Script". Note: This is different from the Profound Effects scripts that you can run through the script console.

At the top of the list is email_methods.jsx this script sets up the generic method for talking to your email server. It's in the next script, email_setup.jsx, where you'll actually set up the preferences.

Mail setup

Selecting the email_setup.jsx script starts a sequence of dialogue boxes running within that script.

1. The first part is to enter your smtp server address. If you don't know it, ask your administrator, or contact your email support or check their FAQ page. If you're running from a web-based email account, you should setup a local mail application to handle the export, then choose that application as the default mail program.

2. The second part is to simply enter your reply-to email. Fairly simple.

3. The third step asks whether or not your smtp server requires you to log in each time you use it. Here's where the system breaks down. If you're at a public computer, or a low security computer, you may want to set up the email application's preferences to allow log in without password. Here's why, if you answer yes, continue. (If you answer "no", skip to step 6)

4. So, you've answered that your smtp account requires you to log in before sending an email. It seems good, because that keeps your email account secure. Hold that thought. First, enter your login I.D.:

5. Next, the script will ask you for your password. Yes - your email smtp password. Now here's the thing: Because this is simple scripting, the prompt window won't conceal your password. It's probably a better idea to log in/out of your email at the application level which will allow for more security.

6. The last part of the setup is to enter the recipient's email.

Rendering & Emailing

In your General Preferences, be sure to turn on "Allow Scripts to Write Files and Access Network". This will allow the script to send something off of the local computer. After Effects ships with the default off. Check the box to activate it.

You must have at least one comp in the render queue in order to make this work, well, because you want something to render, yeah? My fingers usually fly through the cmd-m, caps lock, return key sequence pretty quickly, but this time, just leave your comp in the queue.

Travel back over to the script menus again, and select "render_and_email.jsx". After Effects will now process the render, and when it's done - email you with a completion notification.

Why? Well, my friend Jason uses this when setting his machine to render. Upon render completion, AE sends him an email. When he receives an email, his cel phone automatically rings. Without having to sit and wait at the computer, or within earshot of the chime, he checks his email through the phone - and brrrrrrinnnnng - he finds out that his After Effects project(s) is done. The email also provides information about which render is complete - so you can have multiple machines email you... ...now if we can download that special "Adobe After Effects" chime as a polyphonic cel phone ring we'll have it made. Note: The email address can be set to your text messaging address.


Ko Maruyama is a freelance animator in Los Angeles. When I'm not playing ping-pong waiting for my next render to call me, I can be found talkin' about scripting, compositing and top spin on a 40mm ball in various AE forums. More tutorials