Specifications

10. Scripting concepts
10.1 Scripting overview
PowerSwitch offers a comprehensive scripting environment. With limited scripting experience,
a user can substantially extend Switch's capabilities and provide for interaction with third-party
systems in new and powerful ways.
The various topics in this chapter describe the Switch scripting environment, including its
capabilities for working with metadata.
Note:
In addition to Switch's own scripting environment, certain Switch configurators support executing
JavaScript scripts inside the Adobe Creative Suite applications. These types of scripts are not
discussed in this chapter; instead refer to JavaScript for applications on page 201.
Switch supports two types of scripting languages:
Operating system scripting languages: use the script execution mechanism provided by the
operating system to support a platform-specific scripting language.
Internal scripting language: a cross-platform JavaScript subset implemented and executed
inside Switch.
Operating system scripting languages
Operating system scripting is intended primarily for communicating with other applications or
with operating systems services from within Switch. The supported scripting languages are:
AppleScript on Mac OS X.
VBScript on Microsoft Windows.
In each environment, a script object representing the Switch application provides access to key
variables and functions, including the metadata context of the job being processed.
By definition, operating system scripts are platform-specific (i.e. not portable).
Internal scripting language
The Switch-internal scripting language JavaScript is intended primarily for working with variables
and functions provided by Switch (rather than the operating system). A primary goal of the
internal scripting language is to work with the contents of metadata fields associated with the
jobs being processed.
Switch supports a substantial JavaScript subset (more precisely, it supports a subset of the
ECMAScript 4.0 language), with extensions for:
Accessing key Switch variables and functions, including the metadata context of the job being
processed.
Reading and writing plain text files.
130
Enfocus Switch 10