More Blog Posts

After Effects Command IDs

After Effects Command IDs

The Problem

When building scripts or extensions in After Effects, there are a host of operations that aren’t available via the ExtendScript API such as undo / redo, viewport controls, and others. Thankfully Command IDs exist as a backup option to execute certain operations that can’t be accomplished through the provided API.

Command IDs essentially mimic the behavior as if the user clicked a button, or triggered a hotkey for a particular function. Given this, unfortunately no arguments can be passed to Command IDs and no results can be returned from them, however in some cases, this is the only way to achieve certain workflows.

In the API, you can always try to search for your desired command by name with:

1var cmdId = app.findMenuCommandId('Redo'); // Result: 2035
2app.executeCommand(cmdId);                 // Execute Redo

The problem is, this method is fairly tedious unless you know the exact spelling of the command you’re looking for. Also, this method is not reliable across different languages packages of After Effects, so traditionally, the best practice is to find your Command ID, and then call it directly using the number, not the name.

The Solution

Since there's no official list of Command IDs from Adobe, we’ve put together a simple Viewer built in React to quickly search for a command, and find the Command IDs for each version of After Effects.

To use a command, simply find it’s Command ID number, and execute it with:

1app.executeCommand(2035);

The viewer pulls data from a series of JSON files we've generated for each version of After Effects. (see below)

How it Works

If there's no documentation, then how are we coming up with this list? Fortunately, they happen to be listed in the dictionary files in the application package folder. To do this, we open the application package folder each time a new version of After Effects comes out, and find a compatible .dat file.

DAT File
For example, on Windows, the compatible .dat file we used is located in:
C:\Program Files\Adobe\Adobe After Effects 2022\Support Files\Dictionaries\es_ES

We then run the file through our parser that splits the name from the the command ID. Below is a parser we wrote that's meant to be run with Node.js script, feel free to give it a try:

The parser identifies and organizes all the Command IDs and their corresponding names, and then saves out the data to a JSON file. We've generated JSON files for each version of After Effects from After Effects CC 2015 through the latest After Effects CC 2022.

These can also be useful for referencing in your own scripts or extensions, you can download them below: