Back to Knowledge Base
How to Use Scripts
What are Scripts?
Section titled “What are Scripts?”Scripts are reusable Lua functions callable from Workflows, Custom Actions, and Custom Apps. They encapsulate logic you want to share across multiple Workflows.
Script roles
Section titled “Script roles”| Role | Use case |
|---|---|
| Script | General-purpose Lua, called from Workflow Script nodes |
| JDF Template | Generates JDF job tickets for press equipment |
| JMF Template | Generates JMF messages for machine communication |
| ML Data Query | Returns training data for ML model training |
How to create a Script
Section titled “How to create a Script”- Go to Menu → Developer → Scripts
- Click + New Script
- Enter a Name and select the Role
- Write the Lua code in the editor
- Click Save
Calling a Script from a Workflow
Section titled “Calling a Script from a Workflow”Add a Script node, select the saved Script, and map input variables from the Workflow context. The return value is the node output.
Example
Section titled “Example”-- Calculates a priority score from values passed into the scriptlocal remaining_days = input.remaining_days or 0local weight = input.tier == "premium" and 2 or 1return math.max(0, (10 - remaining_days) * weight)