User Guide Cancel

Scripts

  1. After Effects User Guide
  2. Beta releases
    1. Beta Program Overview
    2. After Effects Beta Home
  3. Getting started
    1. Get started with After Effects
    2. What's new in After Effects 
    3. Release Notes | After Effects
    4. After Effects system requirements
    5. Keyboard shortcuts in After Effects
    6. Supported File formats | After Effects
    7. Hardware recommendations
    8. After Effects for Apple silicon
    9. Planning and setup
  4. Workspaces
    1. General user interface items
    2. Get to know After Effects interface
    3. Workflows
    4. Workspaces, panels, and viewers
  5. Projects and compositions
    1. Projects
    2. Composition basics
    3. Precomposing, nesting, and pre-rendering
    4. View detailed performance information with the Composition Profiler
    5. CINEMA 4D Composition Renderer
  6. Importing footage
    1. Preparing and importing still images
    2. Importing from After Effects and Adobe Premiere Pro
    3. Importing and interpreting video and audio
    4. Preparing and importing 3D image files
    5. Importing and interpreting footage items
    6. Working with footage items
    7. Detect edit points using Scene Edit Detection
    8. XMP metadata
  7. Text and Graphics
    1. Text
      1. Formatting characters and the Character panel
      2. Text effects
      3. Creating and editing text layers
      4. Formatting paragraphs and the Paragraph panel
      5. Extruding text and shape layers
      6. Animating text
      7. Examples and resources for text animation
      8. Live Text Templates
    2. Motion Graphics
      1. Work with Motion Graphics templates in After Effects
      2. Use expressions to create drop-down lists in Motion Graphics templates
      3. Work with Essential Properties to create Motion Graphics templates
      4. Replace images and videos in Motion Graphics templates and Essential Properties
      5. Animate faster and easier using the Properties panel
  8. Drawing, Painting, and Paths
    1. Overview of shape layers, paths, and vector graphics
    2. Paint tools: Brush, Clone Stamp, and Eraser
    3. Taper shape strokes
    4. Shape attributes, paint operations, and path operations for shape layers
    5. Use Offset Paths shape effect to alter shapes
    6. Creating shapes
    7. Create masks
    8. Remove objects from your videos with the Content-Aware Fill panel
    9. Roto Brush and Refine Matte
  9. Layers, Markers, and Camera
    1. Selecting and arranging layers
    2. Blending modes and layer styles
    3. 3D layers
    4. Layer properties
    5. Creating layers
    6. Managing layers
    7. Layer markers and composition markers
    8. Cameras, lights, and points of interest
  10. Animation, Keyframes, Motion Tracking, and Keying
    1. Animation
      1. Animation basics
      2. Animating with Puppet tools
      3. Managing and animating shape paths and masks
      4. Animating Sketch and Capture shapes using After Effects
      5. Assorted animation tools
      6. Work with Data-driven animation
    2. Keyframe
      1. Keyframe interpolation
      2. Setting, selecting, and deleting keyframes
      3. Editing, moving, and copying keyframes
    3. Motion tracking
      1. Tracking and stabilizing motion
      2. Face Tracking
      3. Mask Tracking
      4. Mask Reference
      5. Speed
      6. Time-stretching and time-remapping
      7. Timecode and time display units
    4. Keying
      1. Keying
      2. Keying effects
  11. Transparency and Compositing
    1. Compositing and transparency overview and resources
    2. Alpha channels and masks
    3. Track Mattes and Traveling Mattes
  12. Adjusting color
    1. Color basics
    2. Color management
    3. Color Correction effects
    4. OpenColorIO and ACES color management
  13. Effects and Animation Presets
    1. Effects and animation presets overview
    2. Effect list
    3. Effect Manager
    4. Simulation effects
    5. Stylize effects
    6. Audio effects
    7. Distort effects
    8. Perspective effects
    9. Channel effects
    10. Generate effects
    11. Time effects
    12. Transition effects
    13. The Rolling Shutter Repair effect
    14. Blur and Sharpen effects
    15. 3D Channel effects
    16. Utility effects
    17. Matte effects
    18. Noise and Grain effects
    19. Detail-preserving Upscale effect
    20. Obsolete effects
  14. Expressions and Automation
    1. Expressions
      1. Expression basics
      2. Understanding the expression language
      3. Using expression controls
      4. Syntax differences between the JavaScript and Legacy ExtendScript expression engines
      5. Editing expressions
      6. Expression errors
      7. Using the Expressions editor
      8. Use expressions to edit and access text properties
      9. Expression language reference
      10. Expression examples
    2. Automation
      1. Automation
      2. Scripts
  15. Immersive video, VR, and 3D
    1. Construct VR environments in After Effects
    2. Apply immersive video effects
    3. Compositing tools for VR/360 videos
    4. Advanced 3D Renderer
    5. Import and add 3D models to your composition
    6. Import 3D models from Creative Cloud Libraries
    7. Image-Based Lighting
    8. Extract and animate lights and cameras from 3D models
    9. Tracking 3D camera movement
    10. Cast and accept shadows
    11. Embedded 3D model animations
    12. Shadow Catcher
    13. 3D depth data extraction
    14. Modify materials properties of a 3D layer
    15. Work in 3D Design Space
    16. 3D Transform Gizmos
    17. Do more with 3D animation
    18. Preview changes to 3D designs real time with the Mercury 3D engine
    19. Add responsive design to your graphics 
  16. Views and Previews
    1. Previewing
    2. Video preview with Mercury Transmit
    3. Modifying and using views
  17. Rendering and Exporting
    1. Basics of rendering and exporting
    2. H.264 Encoding in After Effects
    3. Export an After Effects project as an Adobe Premiere Pro project
    4. Converting movies
    5. Multi-frame rendering
    6. Automated rendering and network rendering
    7. Rendering and exporting still images and still-image sequences
    8. Using the GoPro CineForm codec in After Effects
  18. Working with other applications
    1. Dynamic Link and After Effects
    2. Working with After Effects and other applications
      1. Export After Effects project as Premiere Pro project
    3. Sync Settings in After Effects
    4. Creative Cloud Libraries in After Effects
    5. Plug-ins
    6. Cinema 4D and Cineware
  19. Collaboration: Frame.io, and Team Projects
    1. Collaboration in Premiere Pro and After Effects
    2. Frame.io
      1. Install and activate Frame.io
      2. Use Frame.io with Premiere Pro and After Effects
      3. Frequently asked questions
    3. Team Projects
      1. Get Started with Team Projects
      2. Create a Team Project
      3. Collaborate with Team Projects
  20. Memory, storage, performance
    1. Memory and storage
    2. How After Effects handles low memory issues while previewing    
    3. Improve performance
    4. Preferences
    5. GPU and GPU driver requirements for After Effects
  21. Knowledge Base
    1. Known issues
    2. Fixed issues
    3. Frequently asked questions
    4. After Effects and macOS Ventura
    5. How After Effects handles low memory issues while previewing

A script is a series of commands that tells an application to perform a series of operations. You can use scripts in most Adobe applications to automate repetitive tasks, perform complex calculations, and even use some functionality not directly exposed through the graphical user interface. For example, you can direct After Effects to reorder the layers in a composition, find and replace source text in text layers, or send an email message when rendering is complete.

After Effects scripts use the Adobe ExtendScript language, which is an extended form of JavaScript. ExtendScript files have the .jsx or .jsxbin filename extension.

For a description of the scripting capabilities available with After Effects, refer to After Effects Scripting Guide.

Load and run scripts

When After Effects starts, it loads scripts from the Scripts folder. By default, the Scripts folder is in the following locations for After Effects:

  • Windows: Program Files\Adobe\Adobe After Effects <version>\Support Files

  • macOS: Applications/Adobe After Effects <version>

Several scripts come with After Effects and are automatically installed in the Scripts folder. and all loaded scripts are available from the File > Scripts menu.

Note:
  • If you edit a script while After Effects is running, you must save your changes for the changes to be applied.
  • If you place a script in the Scripts folder while After Effects is running, you must restart After Effects for the script to appear in the Scripts menu, though you can immediately run the new script using the Run Script File command.

Scripts in the ScriptUI Panels folder are available from the bottom of the Window menu. If a script has been written to provide a user interface in a dockable panel, the script should be put in the ScriptUI folder. ScriptUI Panels work much the same as the default panels in the After Effects user interface.

Note:

By default, scripts are not allowed to write files or send or receive communication over a network. To allow scripts to write files and communicate over a network,

  • Windows: Select Edit > PreferencesScripting & Expressions > select Allow Scripts To Write Files And Access Network.
  • macOS: Select After Effects > SettingsScripting & Expressions > select Allow Scripts To Write Files And Access Network.
  • To run a loaded script, choose File > Scripts > [script name].

  • To run a script that has not been loaded, choose File > Scripts > Run Script File, locate and select a script, and select Open.

  • To stop a running script, press Esc.

  • To run a script from the command line, call afterfx.exe from the command line. Use the -r switch and the full path of the script to run as arguments. This command does not open a new instance of the After Effects application, and it runs the script in the existing instance.

    For example (Windows): afterfx -r c:\script_path\example_script.jsx

Note:

You can use this command-line technique—together with the software that comes with a customizable keyboard—to bind the invocation of a script to a keyboard shortcut.

You can view the list of 10 most recently run scripts in After Effects. To view the list, select File > Scripts > Recent Script Files.

To rerun any of the 10 most recently run scripts,

  • macOS: Cmd + Option + Shift + D
  • Windows: Ctrl + Alt + Shift + D
Note:

On the AE Scripts website, Lloyd Alvarez offers a tip on how to run .jsxbin scripts if you don't have access to the Scripts or ScriptUI Panels folder.

Scripts included with After Effects

After Effects provides several prewritten scripts to assist you in performing common tasks, and to provide a basis for you to modify and create your own scripts.

Tip:

Run the sample script Demo Palette.jsx to get an idea of what sorts of things you can do with scripts.

Write and modify scripts

You can write your own scripts for use in After Effects by using the script editor, which is part of the ExtendScript Toolkit. The ExtendScript Toolkit provides a convenient interface for creating, debugging, and testing your own scripts. Sometimes, all that you need to do is make a slight modification to an existing script to make it do what you want; such slight modifications can often be performed with little knowledge of computer programming and scripting languages.

To start the script editor, choose File > Scripts > Open Script Editor.

Refer to the After Effects scripting guide for more information.

Scripting access

Motion Graphics templates scripting access

Scripts can add properties to the Essential Graphics panel and export a Motion Graphics template using the following scripting methods:

  • Property canAddToMotionGraphicsTemplate() method
app.project.item(index).layer(index).propertySpec.canAddToMotionGraphicsTemplate(comp) 

Test whether or not the property can be added to the Essential Graphics panel for the specified composition. Returns true if the property can be added, false otherwise. If the property can not be added, it is either because it is not one of the supported property types or the property has already been added to that composition. After Effects presents a warning dialog. 

Supported property types:

  • Checkbox
  • Color
  • Numerical Slider (a single-value numerical property, such as Transform > Opacity or the Slider Control expression control effect)
  • Source Text

Parameters:

comp

The composition that you want to test adding the property to, compItem.

Returns: Boolean.


  • Property addToMotionGraphicsTemplate() method
app.project.item(index).layer(index).propertySpec.addToMotionGraphicsTemplate(comp)

Add the property to the Essential Graphics panel for the specified composition. Returns true if the property is successfully added, false otherwise. If the property is not added, it is either because it is not one of the supported property types or the property has already been added to that composition. After Effects will present a warning dialog. Use the canAddToMotionGraphicsTemplate() method to test whether the property can be added to a Motion Graphics template.

Parameters:

comp

The composition that you want to test adding the property to, compItem.

Returns: Boolean.


  • CompItem motionGraphicsTemplateName attribute 
app.project.item(index).motionGraphicsTemplateName

Read or write the name property in the Essential Graphics panel for the composition. The name in the Essential Graphics panel is used for the file name of an exported Motion Graphics template, for example, My Template.mogrt. The following example sets the name for the active composition and then returns it as an alert: 

app.project.activeItem.motionGraphicsTemplateName = "My Template";
alert(app.project.activeItem.motionGraphicsTemplateName);

Type: String; read/write.


  • CompItem exportAsMotionGraphicsTemplate() method
app.project.item(index).exportAsMotionGraphicsTemplate(doOverWriteFileIfExisting, file_path)

Export the composition as a Motion Graphics template. Returns true if the Motion Graphics template is successfully exported, false otherwise. The name in the Essential Graphics panel is used for the file name of the Motion Graphics template for example, My Template.mogrt. Use the motionGraphicsTemplateName attribute to set the name. Optionally specify the path to the folder where the Motion Graphics template file is saved. If not specified, the file will be saved in the current user's Essential Graphics folder:

  • macOS: /Users//Library/Application Support/Adobe/Common/Essential Graphics/
  • Windows: C:\Users\\AppData\Roaming\Adobe\Common\Essential Graphics\

If the project is changed since the last time it was saved, After Effects prompts the user to save the project. To avoid this, use the project save() method before exporting the Motion Graphics template.

Parameters:

doOverWriteFileIfExisting

Whether to overwrite an exsiting file of the same name, boolean. Required.

file_path

Path to the folder where the file will be saved. Optional.

Returns: Boolean.


  • CompItem openInEssentialGraphics() method
app.project.item(index).openInEssentialGraphics() 

Where to find additional useful scripts

Find scripts, projects, and other useful items on the Adobe Add-ons website.

The AE Enhancers website provides example scripts and useful information about scripting (as well as expressions and animation presets) in After Effects.

 Adobe

Get help faster and easier

New user?