Skip to main content
A script asset points to an ExtendScript file and, optionally, passes it values from the job. Your script reads those values with NX.get.

Fields

string
required
Always script.
string
required
Where to download the script from: a public https:// URL or an inline data: URL. See Your first script.
array
Values your script reads with NX.get. Each item has:
  • key (string, required): the name your script asks for.
  • value (any JSON value): the value your script gets.
  • type (string): set to "function" to pass code. See Function parameters.
string
default:"NX"
The name of the parameters object inside your script. See Rename the parameters object.

Read parameters

Define parameters on the asset:
Script asset
Then read them by key:
promo.jsx
A value can be any JSON type: string, number, boolean, array, object, or null. Nexrender writes each value into the script as JSON, so quotes, line breaks, and non-Latin characters arrive unchanged.
NX.get returns null for a key the job doesn’t define. Give every parameter a fallback, such as NX.get("headline") || "Default headline", so a missing value doesn’t break the render.

Built-in parameters

Every script can read these keys without defining them:

Function parameters

To pass code instead of data, set "type": "function" and put the function’s source in value. NX.get then calls the function with the arguments you pass as an array, and returns its result:
NX.call("formatPrice", [380]) does the same, and returns null when the key isn’t a function. Function sources are ExtendScript too. Without "type": "function", a value that looks like a function arrives as a plain string.

Rename the parameters object

If NX clashes with a name your script already uses, pick another name with keyword:

Several scripts in one job

A job can have any number of script assets. They run in the order you list them, each with its own parameters and its own variables. To hand data from one script to the next, write it to a file in the job folder. See Write a file in the job folder.

Run the same script in After Effects

While you develop a script, you’ll want to run it by hand with File > Scripts > Run Script File. Three things only exist when Nexrender runs the script:
  • NX and nexrender.
  • JSON.parse and JSON.stringify. Plain ExtendScript has no JSON, so when you run the script by hand, include a JSON implementation such as Douglas Crockford’s json2.js at the top.
  • The array methods forEach, filter, and indexOf. Plain ExtendScript doesn’t have them either.
Check for NX and nexrender first: