Tel: +44 (0)1621 813191
PowerSwitch
Scripting

PowerSwitch provides the ultimate in customisability by allowing the use of scripting in various ways throughout the application.

Script Elements

A script element is a flow element that can be added to the flow; connections from and to folders and other tools can be made from it and it behaves just as a regular flow element. The way such as flow element processes files is determined by a script package.

These script packages are created using the standalone SwitchScripter tool, which comes with PowerSwitch. A script package contains the actual script code, defines which properties and connections a script has and what its appearance in a flow (name and icon) will be.

As scripting language, script packages support JavaScript as cross-platform language, Visual Basic scripting edition on Microsoft Windows and AppleScript on Apple Mac. Script elements execute their script each time a job passes through their script element or periodically – based on a timer.

PowerSwitch publishes an extensive API (API stands for application programming interface; a way to communicate with an application) to all three supported scripting languages; these expose parts of the functionality of PowerSwitch to the script and also encapsulate common tasks, making it much easier to write scripts. Amongst other things, the scripting API allows a script to:

• Access information about the script element it is attached to. This allows the script to get the name of the script element, the values of properties defined by the script and more.
• Move jobs along any of the outgoing connections of a script element, or – when necessary – delete the current job or create a new job.
• Read metadata values from the metadata for the processed job. The scripting API contains specific support to work with XMP, XML and JDF metadata.
• Work with text and XML files, either as part of a job or somewhere else on the system.
• Run command-line based applications and evaluate their results.
• Using Visual Basic Scripting or AppleScript get access to all parts of the operating system exposed to these scripting languages. This allows for a very high degree of control of Windows and Mac OS using the scripting engine.

Script Expressions

Script expressions are small pieces of JavaScript, which can be used on key locations throughout the application. Instead of adding new elements to a flow, a script expression allows the user to customise a property of one of the flow elements in a flow. As they are written in JavaScript they are compatible with Microsoft Windows and Apple Mac.

• Currently script expressions can be used to:
• Customise the way files are filtered through a connection.
• Determine dynamically which configuration files are going to be used by configurators. An example is that the PDF Settings for Adobe Acrobat Distiller can be determined dynamically based on the current job by a script expression.
• Determine the name and extension of exported metadata files.
• To view metadata fields for jobs in a checkpoint (see the “Workgroup Support (PowerSwitch)” section).

Script expressions have access to all information about a job and its associated metadata.

© 2002-2010 Crisp Digital Limited. Terms.