In this quick setup guide we will cover how to setup a basic scripting environment for both Mac and Windows. It will streamline your workflow by allowing you to code in your favorite text editor, and run your scripts from the Terminal (OSX) or Command Prompt (WIN) directly in After Effects via a simple command.

Note: This setup is an alternative to using the Adobe ExtendScript Toolkit (ESTK - Adobe’s integrated development environment (IDE) for programming ExtendScript). It is a personal preference whether to use the provided toolkit or your custom editor.

Let's Jump right in

Open you editor of choice. Let’s add a quick alert snippet - we will use this to check if the script is running properly once launched. Feel free to customize you alert message.

alert("Script OK");

Save the script as alert.jsx - notice the extension… After Effects scripts must have this extension in order to be run in AE.


MAC Setup

After Effects on Mac does not currently have the capabilities to run scripts directly via Terminal. We can remedy this with a quick workaround using Applescript - Apple’s own scripting language that allows you to automate tasks on your Mac OS.

Open the Script Editor app or search for it in Spotlight. Then paste the following code, and save:

on run argv
	tell application "Adobe After Effects CC 2019" --specify your version of AE here.
		DoScriptFile item 1 of argv
	end tell
end run

Note: Make sure you specify your version of AE in the script. If you are not sure, navigate to your Applications folder or wherever your AE version is installed and check the version name there.

Find out the version name of AE by navigating to the folder where it's installed.
Find out the version name of AE by navigating to the folder where it's installed.

Understanding the Applescript code

In essence, we are telling (tell) our version of After Effects to run the script (DoScriptFile) that we are specifying. The path to the script is retrieved from the argument (argv) that is passed once we will execute the code (in the next step...).

Let's move on by opening the Terminal app, then type in

osascript

Hit Spacebar once. Now drag and drop your Applescript file into the Terminal window. Next, repeat the drag and drop action but with your alert.jsx file instead.
Your command should look like this:

osascript path/to/yourApplescript.scpt “path/to/alert.jsx"

Note: The quotes that surround the jsx file path ensure that the path is passed as an argument and can be referenced inside the Applescript code (in our case it is passed to the DoScriptFile function that launches the script) - if you dropped a script file path containing spaces in your Terminal window, those spaces will be automatically escaped with a backslash: space\ here. Since we added the quotes already, we don't need to escape the spaces. But if we do, Applescript will assume that the backslashes are part of the file path so won't find your script. Make sure to remove any added backslashes within your quoted filepath.

Now hit Enter. After Effects should launch and, if all is working, it should run our alert.jsx script - you should receive an alert popup with the message you specified.

Alert popup in AE shows script launched successfully
Alert popup in AE shows script launched successfully

That’s it!


WINDOWS Setup

On Windows, After Effects comes installed with an executable that can be used to run scripts via Command Prompt.

First locate the AE executable named AfterFX.exe. This should be found in C:\Program Files\Adobe\yourVersionOfAE\Support Files\ - replace yourVersionOfAE with your current version of After Effects e.g. “Adobe After Effects 2019”.

Open Command Prompt. Drag and drop the AfterFX.exe executable into the Command Prompt window then hit Spacebar and type -r, hit Spacebar again and repeat the drag and drop but this time with your alert.jsx file. Your command should look similar to this:

path/to/AfterFX.exe -r path/to/alert.jsx

Now hit Enter. After Effects should launch and, if all is working, it should run our alert.jsx script - you should receive an alert popup with the message you specified.

Alert popup in AE shows script launched successfully
Alert popup in AE shows script launched successfully

Done!


Quick tips

Previous Command

In both Mac Terminal and Windows Command Prompt - you can call your previous command by pressing the up arrow key. Then Enter.

Command History

The following commands allow you to retrieve a list of previously executed commands:
MAC - in Terminal, type history and press Enter.
WIN - in Command Prompt press F7. Alternatively, type doskey /history and press Enter.


After Effects Scripting Reference:
http://docs.aenhancers.com/

After Effects Scripting Forum & Community

After Effects on Adobe Support Community
Find answers to your questions, or share your expertise with After Effects users in our vibrant community. Search discussions or ask a question about Adobe After Effects.

Editors

Adobe Extend Script Toolkit (Direct Download), then search for Extendscript Toolkit CC

Adobe apps available for download
Learn what Adobe apps are available to download and install. Adobe provides installers for current apps and the previous major version of each.

Brackets Editor:

A modern, open source code editor that understands web design
Brackets is a lightweight, yet powerful, modern text editor. We blend visual tools into the editor so you get the right amount of help when you want it. With new features and extensions released every 3-4 weeks, it’s like getting presents all year long.