The Switch scripting API (application programming interface) provides script elements and script expressions with access to information about the job (file or job folder) being processed, including job ticket and metadata contents. Script expressions are limited to read-only access, while script elements can update the information.
The scripting API supports three scripting languages: JavaScript, AppleScript, and VBScript. The API documentation is provided in JavaScript syntax. Refer to AppleScript and VBScript for information on how to adjust this syntax for the other scripting languages.
The JavaScript language reference is provided as part of the scripting API documentation.
The scripting API consists of a number of distinct modules, each of which publishes a set of related classes and functions. Some modules are published only to the JavaScript scripting language since AppleScript and VBScript offer their own built-in functionality in these areas.
Module |
Description |
Availability |
---|---|---|
Utility module |
Reading and writing plain text files, enumerating files in directories and executing command line applications Text encoding, ByteArray class, File class, Dir class, Process class |
Only JavaScript |
XML module |
Reading and writing XML files, including DOM and XPath access to their contents and performing XSLT transforms Node class, Document class, Element class, Text class, Comment class, Attr class, List classes |
Only JavaScript |
Network module |
Communicating with external applications and web services through SOAP SOAP class |
Only JavaScript |
Database module |
Accessing external databases with SQL queries via ODBC (Open Database Connectivity) DataSource class, Statement class |
Only JavaScript |
Flow element module |
Accessing script flow element properties, including incoming and outgoing connections Moving jobs from and to these connections Accessing job ticket information for the current job, including the list of associated metadata datasets Entry points, Environment class, Switch class, Connection class, Job class, Occurrence class, List classes |
All scripting languages |
Metadata module |
Retrieving the contents of metadata fields from a metadata dataset for the three supported data models (XML, JDF, XMP and Certified PDF 2) Map class, Dataset class, XML data model, JDF data model, XMP data model, CP2 data model, Opaque data model, FileStatistics class, Session class, Certificate class, User class, DataMap class, AltText class |
All scripting languages |
Reference information for the script declaration is presented as part of the scripting API documentation in Main script properties, Execution mode, Property definition properties, Property editors, Validating property values and External property editor.