Note: Print Distributor has now been discontinued.

Note: The Script action is now obsolete, use the new PowerShell action instead.

The Script action allows you to place custom code into the list of actions, this code can read and set any of the variables associated with the document and create new ones. Three languages are supported, PowerShell, VBScript and JScript. Our recommendation is to use PowerShell as it gives you easy access to all the classes of the .Net framework.

A minimal PowerShell script would just be a value that gets echoed to the log, for instance:

"Hello World"

will send the text Hello World to the log.

Use the $context object to create and access variables for use in other actions, for example to replace spaces with underscores in the DocumentName variable:

$name = $context.GetValue("DocumentName")
$name = $name.Replace(" ", "_")
$context.SetValue("DocumentName", $name)

Any variables you set using $context.SetValue are available in templates in subsequent actions.

Note: VBScript and JScript scripts used on previous versions will run but these languages are not recommended for new applications.