The Bot > Event Scripts > Passing Job Details to Event Scripts

Passing Job Details to Event Scripts

When Templater broadcasts events, you can pass versioning data to a registered event script or command by using variables with names prefixed with the dollar symbol($). For example, consider that C:\compress.bat is registered with Templater's Post Job event, and that Templater processed a job with the following versioning data.

[
  {
	"ID": "json_target",
	"title": "Create Targeted Video Ads",
	"caption-1": "Deliver sets of renders",
	"caption-2": "for agencies",
	"album-cover": "yes-oceans.jpg",
	"disc-face": "discs/yes-oceans.png",
	"tint": "2D3A1D"
  }
]

In this case, you can register the following command with Templater's Post Job event to send the title property value, Create Targeted Video Ads, to the Batch file as an argument in the following manner.

C:\compress.bat $title

You can also use as many arguments as needed.

C:\compress.bat $title $caption-1 $caption-2 $tint

Additionally, you can use predefined variables to pass information about a processed job. For example, if your script needs the path to the output file that After Effects rendered, the job's id, and the path to the processed After Effects file, you can use the following:

C:\compress.bat $id $out_file $aep

You can register any command line incantation as if you were entering it in a terminal session.

node C:\dev\event-scripts-master\OSX\concatenate.js $aep $out_dir $id $title

In the above example, concatenate.js will be executed via the node interpreter when the Post Batch event is broadcast, and it will have access to the values of the arguments.

If you choose to register a script file to listen to an event without appending any arguments, you can easily send all available, predefined variables by enabling the For all commands, use job details as arguments checkbox within the Templater Preferences dialog, or by setting the job_details_args property key in the templater-options.json file to true. For example, if C:\compress.bat is registered with the Post Job event, then checking the the For all commands, use job details as arguments checkbox effectively appends the predefined variables as arguments in the following order:

C:\compress.bat $id $rowidx $out_name $out_file $out_dir $aep $aep_dir $data_job

Here is the order of the arguments for the Post Batch event:

C:\concatenate.bat $data_batch $aep $aep_dir $out_dir

Here is the order of the arguments for the On Bot Disable event:

C:\notify.bat $bot_name $aep $aep_dir

 

The following tables show variables that can be used as arguments for your event scripts or commands.

Available arguments for Post Job event script or command

Argument Expands to
${data label} The value of the column or property key specified by {data label} for the most recently processed job. For example, the variable `$headline` expands to the value of the `headline` column header for the most recently processed job
$aep Path to the processed AE project file
$aep_dir Path to the directory containing the processed AE project file
$data_job Path to a json formatted text file file containing job's versioning data
$id The value of the job's `id` column or property, if defined
$idx The job's ordinal position within a batch; `null` if a batch operation is initiated by The Bot.
$out_name The job's devised output name
$out_dir Path to the job's output directory
$out_file Path to the final rendered output if it was rendered successfully; `null` if the target composition was replicated.

 

Available arguments for Post Batch event script or command

Argument Expands to
${data label} The first value of the column or property within a batch of jobs specified by {data label}. For example, `$headline` expands to the first value of the `headline` column in the most recently processed batch of jobs.
$aep Path to the processed AE project file
$aep_dir Path to the directory containing the processed AE project file
$data_batch Path to a json formatted text file file containing versioning data for all jobs within batch
$out_dir Path to the job's output directory

 

Available arguments for On Bot Disable event script or command

Argument Expands to
$bot_name The name of the Bot as found in the Templater Preferences dialog or the `name` property in the`bot` object in `templater-options.json`
$aep Path to the processed AE project file
$aep_dir Path to the directory containing the processed AE project file

 

Related Topics

Event Scripts