Introducing: After Effects Script of the Week

The most recent edition of After Effects Studio Techniques included a new sidebar category: scripts. Over the past several years since it was introduced in After Effects 6.0 , scripting in After Effects has gone from a hidden feature set that a few nerds played around with to reduce tedious tasks, to scripts that provide substantial feature additions in After Effects.

You could refer to scripts as hidden in plain sight, as these highly useful add-ons are now available to everyone, yet not everyone uses them or stays up-to-date with what is available for their use. This new series addresses that.

As something of an evangelist on behalf of the best scripts out there, my goal is to help anyone who uses After Effects – not just the power users – to incorporate these simple additions, one week at a time.

Most of the scripts featured here will link to aescripts.com as a central repository for scripts, where most of them are available as donation-ware. If you want to get moving faster incorporating scripts, browse the descriptions, add a script to your cart, and pay the suggested donation; it goes directly to the developer.

What is a Script?

It sounds technical.

As the name suggests, a script is really “just” a text document containing executable JavaScript code. The word “just” is in irony-quotes there because even a simple script is a coding document, using real – albeit high level – programming language. But you don’t need to code to use them any more that you need to be a mechanic to drive a car.

Scripts arrive already installed in After Effects. In case you’ve never done so, in After Effects, take a look at the File > Scripts menu. It helps if you have a project open that is saved and backed up so you can mess with it a bit.

To get started, try the highly useful Scale Composition script:

Select a composition in the Project panel
Choose File > Scripts > Scale Composition.jsx. A small panel pops up asking for the new dimensions, whether by Scale Factor, Width or Height.
Enter a new scale value – say, 2 in New Scale Factor to make it double size, or 1080 as a New Comp Height setting to make it HD, and click the Scale button.

Not only is the composition scaled, but the contents, including animation keyframes, are scaled and repositioned proportionally. The resulting comp should look identical to the previous version, and if it was a complex comp with a lot of animation, you have just saved yourself a good deal of tedious effort scaling individual layers by hand.

Notice the use of the word “should” in that previous sentence. Unlike feature additions and plug-ins, scripts are not thoroughly beta tested. You may find cases in which running a script, even one so basic as this, results in unintended consequences, which is why it is significant that if a script has been coded properly it usually requires only a single undo command to revert from the multiple steps a script executes.

Working with scripts

That Scripts folder is the ideal place to “install” a new script. You can run a script from anywhere with File > Scripts > Run Script File…, but if you actually use the Finder or Explorer to place a new script in the Scripts folder, which is found in the same folder as the After Effects application itself, the next time you restart After Effects it appears under File > Scripts. If the script has a UI, you can even place it in the Script UI Panels folder and then select it from the Window menu – now it’s a full part of your UI, available in its own panel (more about that next week).

Scripts may generate an error until you change one After Effects preference. Under Preferences > General, enable Allow Scripts to Write Files and Access Network. This is disabled simply because it opens the potential for a rogue script to do malicious damage to files on your system by writing and editing them. It’s a form of disclaimer by Adobe that this is off by default, when in fact I have never heard of a publicly available script that turned out to be malware, let alone the from a trusted source like aescripts.com

Working on scripts

You can also toggle Enable Javascript Debugger in that same Preferences dialog. This pops up ExtendScript Toolkit, which is where scripts are debugged. I use it to let script programmers know where their script went wrong when there’s a problem.

You might think that, like with expressions, the idea is to quickly create your own and put it to use, but the vast majority – over 99% – of script users have no idea how to write one, even if they already use the same ECMA-script code to create expressions. While an expression can be written quickly, even automatically, even the simplest script requires actual programming skills.

If you’re curious what goes into a script, using that ExtendScript Tookit application – or any text editor – to open the Scale Composition.jsx file from within that Scripts folder in Adobe After Effects CS5.5 (by finding that folder using the Finder or Explorer). The script is made up primarily of functions whose purpose is documented on each line that begins with two hash marks // (which causes the comments to show up in green in ExtendScript Toolkit). You can see that even a simple script like this has many components and uses variables, if/then statements and keywords that are specific to After Effects, in order to do its work.

If you want to learn how to script, you can start by hacking – taking pieces of other scripts that do some part of what you want to do, combined with others and with your own code. It helps to know JavaScript, which can be aided by a good book such as the O’Reilly one. The best way to learn to script in After Effects is to take a class such as the one Lloyd Alvarez created for fxphd.com. If you know of other great resources, please share them in the comments section.

Any script written in the .jsx format can be opened in any ordinary text editor, even Microsoft Word (which is otherwise a terrible choice because of the formatting it adds to plain text). Some scripts are instead saved as the copy-protected jsxbin format, in which case the code is not accessible to you any more than the source code of After Effects is accessible.


You never need to look at code to use a script, but in most cases it is there, with comments in green, for you to review and edit in ExtendScript Toolkit, which is installed with Adobe After Effects.

Maintaining scripts

Every time you re-install After Effects, you need to re-install scripts, which just means moving them into the updated Scripts folder. Again, you can run them from anywhere, so you don’t technically need to move them, but finding them in an outside location every time is guaranteed to make the process feel more tedious and thus runs counter to the whole point of scripts.

Scripts do sometimes have to be updated with new versions of software. If you are getting errors with a script you like, it’s worth checking at aescripts.com for an updated version.

As far as maintaining this scripts resource, I plan to add a new script each week, so check back here for a full compendium of great scripts for you to download and start using to extend what you can do with Adobe After Effects.

Support ProVideo Coalition
Shop with Filmtools Logo

Share Our Article

Designer of effects and experiences, author at LinkedIn Learning (lynda.com) and Adobe Press (After Effects Studio Techniques).