Skip to main content
Each example shows the script asset to add to your job’s assets and the script itself. Every example was tested on Nexrender Cloud, in the sandbox. The examples use the compositions and layers of a product promo template: the job renders main_single_products, which contains a single_product composition with text layers such as var_product_name_1. Replace those names with your template’s own. To list them, use GET /v3/templates/{id}/layers or nexrender template layers TEMPLATE_ID.

Log what your script does

nexrender.log writes to the job’s render log. Use it to trace what your script did, and to debug it.
Read the log with nexrender job logs JOB_ID or GET /jobs/{id}/logs:
Render log

Set text from a parameter

Render log
For a plain text change, a text asset does the same without a script. Use a script when the text depends on logic, such as formatting or picking from a list.

Hide a layer based on a parameter

Read data from a JSON file

Download the file with a static asset, then read it from the job’s folder. Set name so the file gets a name you know: Nexrender keeps it as is.
Render log
The order of static assets doesn’t matter: every download finishes before any script runs.
With an inline data: URL instead of an https:// one, Nexrender adds an extension based on the media type. Set name without the extension, such as "name": "products" for data:application/json;base64,..., to get products.json.

Write a file in the job folder

Scripts can create files in the job’s folder: reports, generated data, or files to import into the project.
Render log
The job’s folder is deleted after the render. To keep what a file says, write it to the render log with nexrender.log.

Replace footage with a downloaded image

Render log
An image asset replaces footage without a script. replaceFootage is for cases with logic, such as picking one of several downloaded images.

List the layers of a type

Format values with a function parameter

Render log
This example also renames the parameters object from NX to params with keyword.

Change a property or add an expression

Render log

Load shared code from another file

#include doesn’t work in Nexrender scripts. To share code, download it with a static asset and load it with $.evalFile. Have the file return what it defines: in the sandbox, functions a loaded file declares aren’t visible to the script that loads it.
Render log

Stop the job with a clear error

Throw an error to stop the job before it renders. Start the message with nexrender:: Nexrender then uses it as the job’s error word for word. Without the prefix, the job’s error is After Effects’ longer error output instead.
The job fails with your message as its error:
Job error