Building Adobe Scripts

Scripts
After EffectsAnimatePhotoshopIllustrator
by Justin Taylor on Nov 17, 2021
5 min read

Want to start writing scripts for After Effects, Illustrator, Photoshop, or other Adobe apps? This guide will give you a clear map of the road ahead.

Adobe applications allow 3rd party tooling in three forms: scripts, extensions, and plugins. Scripts are the most simple and quick to get up and running with workflow automation. Check out our previous post for a detailed breakdown on the differences between scripts, extensions, and plugins.

SCRIPTS OVERVIEW

Scripts are the simplest way to automate and optimize various tasks in Adobe apps and are best suited for one-time functions, and simplified user interfaces. Scripts can be used to manipulating layers, set properties, import footage, read data from files, execute renders, automate menu clicks, and so much more.

ExtendScript Background

Scripts are written in Adobe's custom flavor of JavaScript called ExtendScript. If you're familiar with JavaScript in the browser, you should be warned that this is very different. The JavaScript found in most browsers supports the latest ES6 features such as arrow functions, the const and let keywords, modern array functions, and more. Sadly since ExtendScript was based off of the much older ES3 version of JavaScript (released in 1999), none of these features are available.

Nevertheless, most of the core JavaScript components remain intact, plus some additional global objects specific to each individual host Adobe application such as the $ object, app object, and more. If you are looking to include external code libraries, you need to make sure they are compatible with ES3 or you will experience errors on run.

Script UI

ScriptUI is an Adobe-specific addition to ExtendScript for building simple user interfaces. This comes with a collection of widgets for everyday functions including buttons, text fields, checkboxes, treeviews, and more.

Script UI is available via the Window object, not to be confused with the window object found in web browsers, these are completely different. Scripts contain code for the UI and the functionality in the same file.

Debugging

While writing and debugging ExtendScript Scripts has traditionally been accomplished through the Adobe ExtendScript Toolkit (aka ESTK), that application has since been replaced with the up-to-date Visual Studio Code Extension: ExtendScript Debugger.

Files and Delivery

Script files for Adobe apps are typically stored in a single .jsx file and can be run directly in applications via the File > Script menu, or stored in the application's script folder so they can appear in menus or be docked in application layouts.

Scripts also have the option of being encrypted as binary data resulting in a .jsxbin file. JSXBIN files can be generated using the new ExtendScript VSCode extension. Encrypting your code into a .jsxbin has the added benefit of protecting your source code from the casual viewer, and if you import external libraries this process will bundle all those files into a single output file.

START SCRIPTING

Now that you have a basic understanding of what scripts are and how they work, here is what you'll need in order to get started:

These are the only tools you'll need to start scripting in After Effects, Photoshop, Illustrator or any other script-compatible Adobe application.

Note: If you're completely new to programming or JavaScript, a quick tutorial on the basics like this one from W3Schools will help you get off on the right foot. Just note that anything specifically related to the browser like the document object will not exist in ExtendScript.

Documentation

Once you have a goal for your script, investigating the possibilities via the API is the next step.

UI Building

Once you've found the needed API methods to start automating your host application, you need to build up your user interface. The ExtendScript API docs go over this in detail, however there's an even faster way to build your Script UI interfaces:

COURSES

If you're looking for a course to guide you through the whole process start to finish, here are few helpful resources:

After Effects:

Photoshop:

Premiere Pro (Technically CEP panels):

COMMUNITY FORUMS

Plenty of times you'll run into issues that you can't seem to find an answer for in the docs, in this case the community forums are a great place to turn to. These forums are very active, and chances are someone has tried to do what you're trying and can point you in the right direction.

Have questions on getting started? Reach out to the Hyper Brew team and we'd be happy to help!