Switch 2-in-1
Enfocus Switch 10 Contents 1. Copyrights.........................................................................11 2. Introduction......................................................................12 2.1 Welcome to Switch............................................................................12 2.2 Using Switch Help.............................................................................12 Displaying help............................................................................
Contents Canvas.......................................................................................37 Flow Elements pane.....................................................................37 Files pane..................................................................................39 Flows pane.................................................................................41 Folders pane..............................................................................44 Messages pane.....................
Enfocus Switch 10 Working with the canvas...............................................................76 Working with flow elements..........................................................78 Working with properties...............................................................85 7.2 Advanced topics..............................................................................86 Preferences................................................................................86 Working with folders..............
Contents Scripted plug-in.........................................................................138 10.3 Scripting languages........................................................................138 JavaScript.................................................................................138 AppleScript...............................................................................139 VBScript....................................................................................141 11.
Enfocus Switch 10 13.2 Preferences..................................................................................184 User interface preferences............................................................184 Mail send preferences.................................................................185 FTP proxy preferences..................................................................186 Mac file types preferences............................................................186 Processing....................
Contents Uncompress...............................................................................237 Merge PDF Pages........................................................................239 Split PDF in pages.......................................................................241 Hold job...................................................................................243 Inject job.................................................................................246 Rename job.........................
Enfocus Switch 10 Doc group................................................................................299 Email group..............................................................................300 Image group..............................................................................301 IPTC group................................................................................302 Job group.................................................................................303 Metadata group............
Contents 18.1 Scripting API - Introduction..............................................................367 18.2 JavaScript Reference......................................................................368 Language concepts.....................................................................368 Built-in types and objects............................................................371 Built-in functions......................................................................388 Built-in operators..............
Enfocus Switch 10 FileStatistics class......................................................................486 CP2 data model.........................................................................493 Existing functions......................................................................500 Classes.....................................................................................501 19. Data Collecting Wizard......................................................513 19.1 Task description..............
Enfocus Switch 10 1. Copyrights © 2011 Enfocus BVBA all rights reserved. Enfocus is an EskoArtwork company. Certified PDF is a registered trademark of Enfocus BVBA; patent pending. Enfocus PitStop Connect, Enfocus PitStop Pro, Enfocus PitStop Server, Enfocus PitStop Workgroup Manager, Enfocus Instant PDF, Enfocus StatusCheck, Enfocus CertifiedPDF.
Enfocus Switch 10 2. Introduction 2.1 Welcome to Switch Thank you for your interest in Enfocus Switch. Switch was born because so many people like you were looking for a simple yet powerful publishing automation solution. Over the years numerous features have been added to make it easier for you to automate your life. We strive to make our products user-friendly and easy to learn.
Enfocus Switch 10 Icon LightSwitch FullSwitch PowerSwitch Getting more help How to get more help If you run into a problem while installing or using Switch, there are a number of ways to get help: • • Consult this guide. Consult the support section on the Enfocus web site; you'll find an extensive information database, including: a) A set of example flows and scripts (flow library, application library, script library). b) A knowledge base with answers to frequently asked questions.
Enfocus Switch 10 Script library While Switch offers many features "out of the box", some situations require additional customization through scripting. The script library offers a number of example scripts for use with Switch. You can download an example and use it "as is", as a starting point for your own customized script, or just to get a feeling for the capabilities of Switch scripting. To access the script library, go to: http://www.enfocus.com/flows.php.
Enfocus Switch 10 2.3 Switch product flavors Product family Switch offers an impressive array of features, including: • • • • • Visual flow design tools making automated flows easy to setup and deploy. Automatically receiving and sending jobs through FTP or email. Configuring and driving a range of third-party applications used for publishing tasks. Importing, exporting and working with metadata in various formats.
Enfocus Switch 10 3. Installing and running Switch 3.1 Getting ready to run Switch System requirements Resources By itself Switch doesn’t require a lot of resources. You can find the system requirements on the Enfocus website http://www.enfocus.com/contentpage.
Enfocus Switch 10 • For LightSwitch, locate "LightSwitch Installer" • For FullSwitch, locate "FullSwitch Installer" • For PowerSwitch, locate "PowerSwitch Installer" Download the installer from internet To download the latest version of the installer: 1. Visit the Enfocus web site and go to the download section. 2. Download the appropriate installer for your operating system. 3. Locate the installer where you saved it on your computer.
Enfocus Switch 10 Installing language packs Selecting the desired language After installing the language pack, perform the following steps for each Switch application (designer & server; scripter; client): 1. Quit the Switch application (if you have not already done so). 2. Launch the Switch application. 3. Open the Preferences on Mac Choose Preferences from the application menu on Windows For Switch (designer & server) and SwitchScripter, Choose Edit > Preferences .
Enfocus Switch 10 6. Select a new location for the application data root that offers full access rights to the intended limited user(s). 7. Switch guides you through the procedure of relocating the application data root. 8. Quit Switch . 3.2 Running Switch for the first time Preparing to run Switch Depending on what you intend to use Switch for, you will need different pieces of information to get Switch completely up and running.
Enfocus Switch 10 Before you can activate or deactivate licenses, you should set up an activation account using the Enfocus website (http://www.enfocus.com/CreateAccount). Creating an activation account 1. Go to http://www.enfocus.com/CreateAccount. 2. Enter the appropriate information in the fields. 3. If you would like to receive news from Enfocus or be contacted by an Enfocus Certified Partner, leave the two bottom checkboxes selected; otherwise, clear them. 4. Click Create my Account. 5.
Enfocus Switch 10 4. Enter the name and password of your activation account and click Next / Continue. Note: You should have created this activation account in Creating an activation account on page 20. If you haven’t created an activation account yet, click the Create a new Enfocus Account link in the Wizard/ Assistant and see Creating an activation account on page 20 for instructions. After you click Next / Continue, a status bar appears while the system communicates with the activation server.
Enfocus Switch 10 3. Select On-line activation and click Next / Continue. 4. Enter the product key and click Next / Continue. 5. Enter the name and password of your activation account and click Next / Continue. Note: You should have created this activation account in Creating an activation account on page 20. If you haven’t created an activation account yet, click the Create a new Enfocus Account link in the Wizard/Assistant and see Creating an activation account on page 20 for instructions.
Enfocus Switch 10 3.4 Third-party applications Installing third-party applications Switch interacts with a number of frequently-used third-party applications through built-in configurators. For a Switch configurator to work with the corresponding third-party application, follow these guidelines: • • • Obtain a version of the third-party application that is supported by Switch; see Third-party applications on page 23.
Enfocus Switch 10 Installed tab This tab provides users with the following options: 1. A search field 2. An Actions button 3. A list of all installed configurators 4. Search for updates button 5. Uninstall button 6. Install button For the listed configurators, information such as Name, Icon, Description, Link to Crossroads application page, Compatibility (Switch version), Compatibility (3rd party version and flavor), Status (installed, installed and up-to-date, not installed) are displayed.
Enfocus Switch 10 2. An Actions button 3. A list of locally stored packs (example: packs that were downloaded but not yet installed, installed packs appear in the Installed tab) 4. Browse for folder button 5. Uninstall button 6. Install button For the listed configurators, information such as Name, Icon, Description, Link to Crossroads application page, Compatibility (Switch version), Compatibility (3rd party version and flavor), Status (installed, installed and up-to-date, not installed) are displayed.
Enfocus Switch 10 Searching from the Flow Elements pane If during startup Switch does not detect a third-party application that has been successfully installed, you can trigger a search for the application through the context menu offered by the Flow Elements pane (as shown above). You can also use this function if you did not quit and restart Switch after installing a third-party application. To search for the third-party application corresponding to a configurator: 1.
Enfocus Switch 10 4. Click Open Note: Some configurators do not offer this function. Licensing third-party applications You must legally obtain a valid license and installation kit from the application's vendor (or its representatives) for any third-party application used in conjunction with Switch. Enfocus does not sell, distribute or support third-party applications.
Enfocus Switch 10 Some configurators support licensing the corresponding third-party application from within Switch through the context menu offered by the Flow Elements pane. In the Switch application, navigate to Help > License > License third-party plug-ins to view the License third-party plug-ins dialog box. Use this dialog box to enter license key received from the third-party vendor and click License button to activate it.
Enfocus Switch 10 When validation of a license key is unsuccessful, a message box appears displaying the message This license key is invalid, does not correspond to the serial number of this copy of Switch or does not apply to any installed third-party plug-in. Verifying the licensing status To verify the licensing status for the third-party application corresponding to a configurator: 1. Bring up the context menu for the configurator's icon in the elements pane. 2.
Enfocus Switch 10 It is possible though to install and run multiple Switch product flavors in parallel, since each flavor has its own preferences and application data. For example, you could run FullSwitch 07 and PowerSwitch 08 at the same time on the same computer. Version change detection After installing a new version of Switch, when it is launched for the first time, Switch detects the version change and presents a warning dialog.
Enfocus Switch 10 4. Finding your way around Switch 4.1 Switch application components Switch offers its functionality through a number of separate applications, each with a distinct function. Switch server The Switch server runs in the background, managed and monitored by the Switch Watchdog, to execute flows. It is automatically started and terminated as needed by the Switch designer. If so requested, the Watchdog can continue running after the user quits the designer.
Enfocus Switch 10 SwitchClient SwitchClient is a light-weight desktop application that allows a user on a different computer to submit and monitor jobs. Since it usually runs on a different computer, SwitchClient has its own installer. For more information see Working with SwitchClient on page 143 4.
Enfocus Switch 10 Toolbar The toolbar is the strip at the top of the workspace offering a number of tool buttons. See Toolbar on page 36 for more details. Panes and views The workspace contains a number of panes which can be manipulated as distinct entities (show, hide, resize, move, ...). Examples include the flows pane, the elements pane, and the properties pane.
Enfocus Switch 10 The central area that displays a flow design is called the canvas; it is a special pane because it has no title bar and it can't be moved from its central position. One or more panes (optionally including the canvas) combine to make up a workspace configuration called a view. The currently displayed view is selected by pressing one of the buttons in the leftmost section of the toolbar.
Enfocus Switch 10 Panes The workspace offers the following panes, which can be combined at will in the different views Pane Description Canvas Displays and allows interaction with a flow design Dashboard Displays status information on problem jobs or processes, as reported by the Switch server Elements Lists the icons representing flow elements that can be dragged onto the canvas Files Serves to view and explore the contents of flow element backing folders (i.e.
Enfocus Switch 10 Pane Description Users Allows managing SwitchClient user names, passwords and access rights Toolbar The toolbar is the strip located at the top of the workspace window; it contains a number of tool buttons to accomplish common tasks. For example, this is the toolbar in the default workspace configuration (design view): Some icons cannot be found on the toolbar any longer.
Enfocus Switch 10 Tool set Shown with Function See Messages pane in Workspace overview on page 32 Users Allows managing SwitchClient user names, passwords and access rights. Allows export and import of user's information See Users pane in Canvas The canvas is the central workspace area that allows viewing and editing flows. Here's an example of a simple flow displayed in the canvas: To display a flow in the canvas, select it in the flows pane.
Enfocus Switch 10 To toggle between large and small icons, choose the appropriate context menu item shown for the Flow Elements pane. Filtering You can use the Search field on top to filter the Flow Elements. See Filtering on page 48 Favorites The Favorites section can contain shortcuts to elements in other sections. It looks and functions like other section headers, but its content is managed by the user.
Enfocus Switch 10 Section Description Configurators Configurators for third-party applications for processing jobs Metadata Built-in tools for working with metadata, including XML Custom Custom applications Flow elements The list of flow elements displayed in the elements pane depends on the Switch product flavor you have installed. See the Flow element matrix on page 178 for an overview.
Enfocus Switch 10 Icon Row represents Information displayed A job file (*) File info; Job info A regular folder Folder info A regular file File info File pane columns The rows in the files pane have multiple columns as listed in the following table. Individual columns can be shown or hidden through the "Show columns" context menu item. By default, only a subset of the columns is shown. The visible columns can be resized and reordered by dragging.
Enfocus Switch 10 Column Description Entered state The date/time the job entered the state currently attached to it, or blank if there is none (a state can be attached to a job through the “Attach job state” property of the folder flow element; also see preparing for state statistics) Submit point The name of the Submit point through which the job was submitted, or blank if it wasn’t submitted through a Submit point Submitted The date/time the job was submitted through a Submit point, or blank if it
Enfocus Switch 10 Filtering You can use the Search field on top to filter the Flows. See Filtering on page 48 Actions The Actions drop-down list contains all the items that are available in the Flow menu on the menu bar. Flows and groups Each row in the flows pane represents a flow or a group. A group can contain flows and other groups, up to any nesting level. When you select a group, all the flows in the group (and in any subgroups) are automatically selected as well.
Enfocus Switch 10 Flow Group Description The flow can’t be activated because it contains a design error The flow is being activated The flow is active, i.e. it is being executed by Switch The flow is being deactivated The flow is inactive and it is locked for editing Name and description You can rename a row by clicking on the name field and entering the new name. You can also change the value of the "Name" property in the properties pane.
Enfocus Switch 10 Folders pane The Folders pane serves to browse folders (not files) in the local file system and allows dragging backing folders to the canvas. You can use the Folders pane to: • View folders in the file system that is reachable from the computer on which Switch is running. • Add a folder to a flow by dragging it from the folders pane onto the canvas. • Change the backing folder for an existing flow element by dragging a folder from the folders pane onto the flow element.
Enfocus Switch 10 New messages are continuously added to the list while Switch is operating. Warning and error messages are shown in color. Type search strings in the filter fields at the top of the Messages pane to select the subset of messages to be displayed. Messages can be sorted in different ways by clicking on the column headers. Columns can be reordered and resized by dragging. For more information see Viewing log messages on page 107.
Enfocus Switch 10 For more information, see Viewing processes on page 111. Properties pane The Properties pane shows all properties for the selected flow in the Flows pane or for the selected flow element in the canvas. If multiple flow elements are selected, the common properties are shown, and if the flow is inactive, these common properties can be changed. The name of each property is displayed on the left, its value on the right.
Enfocus Switch 10 For more information, see Working with properties on page 85. Activity monitor Switch offers five panes to monitor activity/ manage workload. These are: 1. General load indicator pane 2. Dashboard pane 3. Progress pane 4. Network activity pane and 5.
Enfocus Switch 10 For more information see Activity monitor and workload management on page 114. Users pane The Users pane allows managing the access rights of users accessing the Switch server from SwitchClient copies installed on other computers in the network. Specifically, it allows configuring: • The list of users recognized by the Switch server. • The list of groups of users (each user is part of exactly one group) • The access rights for each group of users.
Enfocus Switch 10 The set of items shown in the list adjusts with each keystroke in the search field, showing only items that satisfy the search term(s). If the search field is not empty, a clear button appears at the right of the field, to clear the search field and show all elements. Using the search menu You can open the search menu by clicking the Search button on the left side of the search field. The search menu contains: • the last 7 strings entered in the field.
Enfocus Switch 10 Distribution and licensing SwitchScripter is part of the PowerSwitch product and is automatically installed as a separate application by the PowerSwitch installer. SwitchScripter does not require a license key; any registered PowerSwitch user is entitled to use SwitchScripter. 4.
Enfocus Switch 10 5. Creating and executing a flow 5.1 Performing the tutorial In this tutorial we will build a simple flow in order to demonstrate designing and executing a flow. Functions of the tutorial flow The tutorial flow shows how a small publisher automates reception of PDF files. The flow will: 1. Get files from an FTP server. 2. Get files from a network folder (for files delivered on a CD or other removable medium). 3. Sort all files into PDF and non-PDF files. 4.
Enfocus Switch 10 5.3 Adding the input folder 1. Make sure the tutorial flow is selected in the Flows pane. 2. In the Elements pane, make sure the "Basics" group is displayed (click on the title of the group if it is currently hidden). 3. In that group click on the icon called "Folder" and drag it onto the canvas. Drop the folder somewhere on the left-hand side of the canvas. The name of the folder automatically becomes "Folder 1" after you have dropped it onto the canvas. 4.
Enfocus Switch 10 Your flow should now look like this: 3. We now need to connect our folders. To connect the "Input Folder" and the "PDF Files" folder do one of the following: • In the Elements pane, click on the "Connection" element and drag it out onto the canvas. Drop the connection icon on top of the "Input Folder" icon on your canvas; or • Double-click on the "Input Folder" icon.
Enfocus Switch 10 7. Click on the "Define File Types" item in the list. The file type editor appears. 8. In the file type editor, move the "Adobe PDF (*.pdf)" file type to the right hand list by selecting it in the list on the left and clicking Add > button. The editor should look like this: 9. Click Ok button to accept the changes. You have now created a connection that moves only Adobe PDF files. 10. Select the connection to the "Other files" folder. 11.
Enfocus Switch 10 The solution to this is to create a "user-managed" folder for our drop folder. This will be a folder on the network (or local computer) in a location that we can publish to our other users in the network so that they can drop files in the flow. 1. Begin by dragging one more folder on the canvas, to the left of your flow. 2. Rename the folder "Drop Folder" and connect it to the "Input Folder". 3. Make sure the "Drop Folder" is selected in the canvas 4.
Enfocus Switch 10 If you do not have access to an FTP server you can safely skip this step and go on with the next step in the tutorial. 1. In the Elements pane scroll down until you see the "Communication" section. 2. In that section click on the "FTP receive" tool and drag it onto the canvas to the left of the "Input Folder". 3. Now connect the "FTP receive" tool to the "Input Folder" in the same way as you would connect two folders.
Enfocus Switch 10 5.7 Testing the partial tutorial flow Now that we are this far, it is time to test our partial tutorial flow. 1. Drop two files on the FTP server, one PDF file and one other file. Alternatively you can drop the files in the drop folder, bypassing the FTP server. 2. Activate the flow by clicking the tool button. If the flow is successfully activated, the canvas shows a darker background to indicate that the flow can no longer be edited. See Activating and deactivating flows on page 73.
Enfocus Switch 10 To remove this unique name prefix at the end of a flow, set the strip unique name property for the final folder to yes. Proceed to the next topic: Delivering the PDF files through FTP. 5.8 Delivering the PDF files through FTP In a real world workflow, your PDF files would probably have to be processed in a particular way; for this tutorial however we will assume we can just forward them to our printer (the next step in the chain). 1. Make sure that the flow is inactive. 2.
Enfocus Switch 10 5. Proceed to the next topic: Sending files via email. 5.9 Sending the non-PDF files via email To finish the tutorial flow, you are going to use two additional tools to compress and email the non-PDF files to an internal customer relationship staff member. 1. From the "Tools" section in the elements pane, drag the "Compress" tool on the canvas. 2. Connect the "Other Files" folder to the new "Compress" flow element. 3.
Enfocus Switch 10 All other values can remain set to their default value for the purpose of this tutorial You have now just created a flow which sends out email messages. Before you can activate this flow, you need to make sure that your email preferences are set up correctly. 6. Select Edit > Preferences... (Windows) or PowerSwitch > Preferences (Mac) to open the User Preferences dialog box. 7.
Enfocus Switch 10 6. Managing flows 6.1 Creating a new flow Creating a new flow To create a new flow, follow one of these steps: • Click the Create new flow... tool • Select the Flow > Create new... menu item; or • Select the New flow... menu item in the context menu of the flows pane. button; or The Create new flow wizard(a special dialog) appears to guide you through the rest of the process. The different pages of the flow wizard are described by the remaining topics in this chapter.
Enfocus Switch 10 Receive and sort files creates a flow which will allow you to receive files through FTP and/or email, sort all incoming files in folders based on file type and file names and send notification emails if and when needed. Install sample flows imports one or more sample flows that were installed with the Switch application. 2. Click Next button. Setting flow properties This flow wizard screen allows you to set properties for the created flow. 1.
Enfocus Switch 10 Note: The above dialog box appears only if you had selected "Receive and sort files" for type of flow. Configuring an FTP server Use this dialog box to set the properties for an FTP Server from where you want to download files. See FTP receive on page 258 for more information on the various properties in this dialog box. Receiving files through email This flow wizard screen allows you to specify one or more email accounts from which files need to be downloaded.
Enfocus Switch 10 Configuring an email server Use this dialog box to configure an email account from which you want to receive files. See Mail receive on page 263 for more information on these various properties. Sorting files into folders This flow wizard screen allows you to set up one or more sorting rules to sort all incoming files into folders.
Enfocus Switch 10 Note: The above dialog box appears only if you had selected "Receive and sort files" for type of flow. Configuring a sorting rule Use this dialog box to set up a sorting rule to sort files into folders. Depending on whether you specified sorting on file type or file name in the flow wizard, this dialog window will look different. Sorting on file type See Specifying file filters on page 97 for more information on filtering and file types.
Enfocus Switch 10 See Specifying file filters on page 97 for more information on filtering and filename patterns. Sending notifications This flow wizard screen allows you to specify if and how email notifications should be sent out when files are received. Note: The above dialog box appears only if you had selected "Receive and sort files" for type of flow.
Enfocus Switch 10 Finishing up This flow wizard screen displays the summary of all the settings configured so far. Review the settings and click Finish buttton to create the flow. Created flow When you click the Finish button, Switch automatically creates a new flow with the information provided.
Enfocus Switch 10 All flow elements are configured with appropriate property values. Modify and further expand the flow at will using any of the flow design tools offered by Switch. 6.2 Working with flows Organizing flows The Flows pane lists all flows currently known to Switch. It allows organizing these flows in a hierarchy of groups and subgroups, and provides a context menu for managing flows in various ways.
Enfocus Switch 10 Adding a group You can use groups to organize flows into a structure resembling a tree, much like files in a folder tree. A group can contain flows and other groups, up to any nesting level. To add a new group in the Flows pane, perform the following steps: 1. In the Flows pane, select the row after which the new group should be inserted. 2. Choose the New group menu item in the context menu of the Flows pane. 3.
Enfocus Switch 10 1. Select the flows you want to mark. 2. Choose the Set marker menu item in the context menu of the Flows pane, and select one of the markers in the submenu. Clear a marker for a flow To clear the marker for one or more flows, perform the following steps: 1. Select the flows for which you want to clear the marker. 2. Choose the Set marker menu item in the context menu of the Flows pane, and select "No marker" the submenu. Marker for a group Marker cannot be set for a group.
Enfocus Switch 10 Adding flows • See Creating a new flow on page 61 • See Importing flows on page 74 Duplicating flows To make a copy of one or more existing flows, select the flows in the Flows pane, and perform one of these steps: • Press the Duplicate flows tool button, or • Choose the Flow > Duplicate menu item, or • • Choose Duplicate menu item in the context menu of the flows pane, or Drag the selected flows to a different location and hold the appropriate modifier key while dropping the fl
Enfocus Switch 10 Click Yes button to delete the flow, or No to retain the flow. Locking and unlocking flows A flow in the Flows pane can be locked for editing. When a flow is locked, the Flows pane shows the state icon even when the flow is inactive, and no changes can be made to the flow design or to the flow’s properties. The flow can still be activated as usual. Locking status is preserved when the flow is exported and re-imported.
Enfocus Switch 10 Unlocking flows To unlock one or more flows, select the flow(s) in the Flows pane, and perform one of these steps: • Choose the Flow > Unlock menu item, or • Choose the Unlock menu item in the context menu of the Flows pane If the selected flows were locked without password, Switch unlocks them without further ado. If one or more selected flows were locked with a password, Switch displays a dialog requesting a password (and unlocks only flows that match the provided password).
Enfocus Switch 10 • Choose the Deactivate menu item in the contextual menu of the Flows pane. Importing and exporting flows Flows can be exported to make a backup or to share them with someone else. Likewise if you have an exported flow you can import that flow into your copy of Switch and have the flow appear in the Flows pane. Exported flows have the "sflow" filename extension.
Enfocus Switch 10 • Double-click the file; this will launch Switch if it is not yet running and import the flow. • Drag and drop the file on to the Flows pane in Switch; this will import the flow. Compatibility considerations When exporting a flow, Switch stores a maximum amount of information in the exported flow file: • The list of flow elements and connections as they are shown in the canvas, including the geometry.
Enfocus Switch 10 7. Designing flows 7.1 Basic concepts Working with the canvas The canvas is the central workspace area that allows viewing and editing flows. The canvas always displays the flows selected in the Flows pane. Single flow at full size When a single flow is selected, the canvas displays it at full size and scroll bars appear if the flow design is larger than the visible area. In this mode the flow is editable (assuming that it is inactive and unlocked); see Editing a flow on page 78.
Enfocus Switch 10 When two or more flows are selected, the canvas displays a tile for each flow. A tile is a scaled-down version of the flow design similar to a thumbnail. Tiles can't be edited. However you can select a particular tile and edit its flow properties in the Properties pane. In tile mode the canvas never shows horizontal scroll bars. Instead the size of the tiles is adjusted so that a predefined number of tiles fit on a row. The maximum number of tiles shown can be set as well.
Enfocus Switch 10 Editing a flow Before making changes to a flow: • Ensure that the flow is inactive and unlocked; an active or locked flow is displayed with a darkened background and cannot be edited. • Select the flow in the Flows pane without selecting any other flows; when multiple flows are selected the canvas shows tiles which cannot be edited. Working with flow elements A flow design (as displayed in the canvas) consists of a number of interconnected flow elements.
Enfocus Switch 10 Inserting a flow element on an existing connection You can insert a flow element on an existing connection, putting the new flow element in between the others. The flow element that you insert can be dragged from the Elements pane, or you can drag and drop an existing flow element from the canvas, if it does not have any connections yet.
Enfocus Switch 10 Selecting flow elements To select a flow element, click it in the canvas. There is visual feedback to indicate the selected item. In the first example shown above, the "Folder 2" flow element is selected (it is surrounded by a gray rectangle). In the second example, the connection is selected (it is drawn in color). Multiple selection You can select as many flow elements as you like at the same time, except that a connection and other flow elements cannot be selected at the same time.
Enfocus Switch 10 1. Select the flow element on the canvas (ensure only one flow element is selected) 2. Click the flow element name on the canvas 3. Enter the new name or adjust the existing name. Other properties When a single flow element is selected on the canvas, the Properties pane shows its properties. See Working with properties on page 85. When multiple flow elements are selected, the Properties pane shows all mutual properties, i.e. the properties that can be set for every selected flow element.
Enfocus Switch 10 The FTP server address and corresponding login information fields are empty, causing the alert icon to appear. (Switch provides meaningful default values for most properties, but that seems impossible in this case). Adjusting the layout of the design To adjust the layout of the flows design, select one or more flow elements (other than connection) and drag the selection around, or use the arrow keys to "nudge" the selection to the indicated direction in small steps.
Enfocus Switch 10 After adding a new connection, it is drawn as a straight line between the two flow elements, as indicated in the upper left corner in the above example.
Enfocus Switch 10 When pasting flow elements into a flow, Switch renames the new flow elements if needed to avoid name clashes between backing folders.
Enfocus Switch 10 • Choose the Edit > Redo menu item. Working with properties Properties pane The Properties pane shows all properties for the selected flow in the Flows pane or for the selected flow element in the canvas. The name of each property is displayed on the left, its value on the right.
Enfocus Switch 10 Pressing the button displays the property editor dialog for the property. For example: Update the fields offered by the dialog box and click Ok button to change the property value, or Cancel button to leave the value unchanged. Multiple property editors Many properties offer multiple property editors. In that case, when you select the property, a button appears at the right-hand side of the property value.
Enfocus Switch 10 Select one of the group names in the leftmost list to access the preferences in that group. Individual properties are displayed and can be edited in a manner similar to those in the Properties pane; see Working with properties on page 85. For more information on Preferences, see Preferences on page 184 Working with folders Working with individual files in Switch is quite straightforward.
Enfocus Switch 10 certain level (specified in a property), and injects those files into the flow along its output connection(s). The injected files are placed in the output folder(s) at the highest level, in effect flattening the subfolder hierarchy. However, if so requested, the original location in the hierarchy is stored with the file (in its internal job ticket) so that it can be retrieved later to recreate the hierarchy. See Using hierarchy info on page 91 for more details.
Enfocus Switch 10 To inject a job folder in a flow, you need an active flow. Otherwise it will take the folder path of this folder as its new input folder and will treat all files as single jobs. The job folder will be moved along the flow and processed as a single entity. It is also possible to submit job folders through a "Submit hierarchy". In that case you need to make sure that the "Subfolder levels" property is set correctly, as explained in working with subfolders above.
Enfocus Switch 10 To create a job with (nested) subfolders, you can use the same mechanisms as described above for archive hierarchies. See Using hierarchy info on page 91 for more details. Leaving originals in place Default mode of operation In its default mode of operation, Switch moves incoming jobs out of the input folder when injecting them into a flow. In this mode, Switch needs full access rights to rename, create and remove files and folders in the input folder.
Enfocus Switch 10 • Certain flow design changes (turn off “leave originals”; change backing folder) automatically clear the list when the flow is next activated. Configurators A configurator is a Switch flow element that drives a third-party application as part of the execution of a Switch flow. The application must be installed on the same computer as Switch (and it will also be launched on that computer).
Enfocus Switch 10 See also Working with folders on page 87. Hierarchy location path The hierarchy location path (stored in a job's internal job ticket) consists of zero or more segments, and each segment represents the name of a (sub)folder in a nested folder structure. The first segment represents the top-level folder.
Enfocus Switch 10 • Proof and Original are configured to add their own folder name at the bottom of the hierarchy location path. • Archive is configured to accept two subfolder levels. Then the following Submit hierarchy: Will result in this Archive hierarchy: Specifically, submitting a file named "File.tif" in folder "Submit/CustomerA" will result in two archived files (in addition to the proof being mailed out): • The original "File.tif" will be placed in "Archive/CustomerA/Original".
Enfocus Switch 10 This editor allows entering a single set of email info consisting of a list of email addresses and a segment of body text. It is used, for example, for editing the "attach email info" property of a folder. If the email info is non-empty, it is associated with every job that passes through the folder.
Enfocus Switch 10 If the mapping table contains an entry for the special key with non-empty email information, this is added for all jobs regardless of their key. Attaching Email info When associating email information with a job, Switch combines the new email information with any email information already present. Email addresses are added to the list, and body text is appended to what's there (inserting a line break if needed).
Enfocus Switch 10 subfolder names in the job's nested subfolder path is used as a key in the mapping table. The email information for all matches is combined and associated with the job. Folder A folder provides just a single set of email information. If it is non-empty, the email info is attached to each job passing through the folder.
Enfocus Switch 10 Example flow on receiver’s side Specifying file filters Several Switch tools offer file or folder filter properties, including for example: • the "Include/exclude these files" properties on connections leaving a folder. • the "Include/exclude these folders" properties on connections leaving an FTP receive instance. Each of these properties can be set to a particular file or folder filter that "matches" a certain category of jobs based on the filter's characteristics.
Enfocus Switch 10 Filter type Description All other files Matches all files and job folders not moved by any other connection (see All other files for more details) File types A predefined list of cross-platform file types.
Enfocus Switch 10 A flow element can have more than one outgoing connection that uses the "All other files" filter. In that case all of these connections match the same set of files and job folders: those not matched by other connections using e.g. file type, file pattern or regular expression filters. Folder filters A folder filter is applied to a subfolder of the folder hierarchy from which files are being retrieved.
Enfocus Switch 10 Property name Description Possible values are: • • Adjusted by (rule 1) Editors Default All folders No folders Defines a rule for adjusting Dropdown list the set of folders that should be processed by including or excluding folders None Possible values are: • Including folders named • Including folders not named • Excluding folders named • Excluding folders not named .. Folder name .. On levels ..
Enfocus Switch 10 Property name Description • Don’t include nested subfolders Editors Default Possible values for “excluding” rule are: • Exclude nested subfolders as well • Dont exclude nested subfolders Adjusted by (rule 2) .... Same as rule 1 with an identical set of dependent properties Adjusted by (rule 5) Applying rules The rules are applied in the same order as they are specified. It is perfectly possible for a rule to exclude folders that were included by a previous rule, or vice versa.
Enfocus Switch 10 Property name .. Nesting Value for “Process only these Value for “Skip these folders” folders” “Exclude nested subfolders as “Exclude nested subfolders as well” well” These values should produce the same behavior as in the previous Switch version.
Enfocus Switch 10 8. Running flows 8.1 Monitoring flow execution Viewing an active flow An active flow is currently being executed by Switch server, i.e. it is processing jobs. The active state is indicated by the icon next to the flow name in the Flows pane, and by the darkened background in the canvas. See Activating and deactivating flows on page 73 and Flows pane on page 41.
Enfocus Switch 10 Scanning folders and checking Mail / FTP Switch automatically scans the contents of backing folders and checks Mail and FTP in an active flow at regular intervals. The interval between scans is governed by global user preferences; see Preferences on page 184. When testing a flow it is sometimes impractical to wait for the next interval scan. Therefore: • The "scan now" context menu for Folder and Submit hierarchy elements causes Switch to immediately scan the corresponding backing folder.
Enfocus Switch 10 Although editing in the Properties pane is disabled while a flow is active (see activating and deactivating flows), the status of the "Hold files" property can be modified at any time through the context menu of the connection.
Enfocus Switch 10 In this example the connections are setup to duplicate the incoming job (one copy in each output folder). When the first connection is put on hold, the copies for that connection are held in the input folder until the connection is released. The copies for the other connection proceed without interruption. FTP receive example In this example, file filters have been setup for the connections leading from the FTP receive tool.
Enfocus Switch 10 Traffic light connections carry data or log information for the same job, so it does not make sense to put a single connection on hold independently. When one of the connections is put on hold, all other connections are automatically put on hold as well, effectively disabling the originating tool. Generic application example In this example, the generic application tool is used to integrate an external hotfolder application in the flow.
Enfocus Switch 10 New messages are continuously added to the list while Switch is operating. Warning and error messages are shown in color. Wrap text To display long messages on multiple lines (i.e. "wrapped" rather than chopped off): Choose the "Wrap text" menu item in the context menu of the Messages pane. Columns The following table describes the columns in the Messages pane. You can resize and reorder the columns by dragging the column headers.
Enfocus Switch 10 Filtering and sorting log messages Filter fields Each column in the Messages pane has a filter field which is placed just above the column header. A filter field allows text entry and remembers the most recently entered values in its drop-down list. The contents of the filter field serves to filter messages for display in the Messages pane based on the value of the corresponding column. Message filtering is performed “live” while a filter value is being entered or updated.
Enfocus Switch 10 Exporting log messages The messages currently displayed in the Messages pane (after filtering) can be exported to an XML file for processing by third-party tools. To export log messages, perform the following steps: 1. Setup filters (as explained above) so that the Messages pane displays just the messages you want to export; the sorting order doesn't matter. 2.
Enfocus Switch 10 • Choose the "Clear log messages" menu item in the context menu of the Messages pane. A confirmation dialog appears. If you press the "Yes" button, all messages will be removed from the log database; there is no undo for this action. Viewing processes The Progress pane displays a list of currently executing processes (for all active flows) with their progress information.
Enfocus Switch 10 Wrap text To display long messages on multiple lines (i.e. "wrapped" rather than chopped off): Choose the "Wrap text" menu item in the context menu of the Dashboard pane. Problem categories Switch distinguishes between problem jobs (which cannot be processed because of an issue with the job itself) and problem processes (where jobs cannot be processed because of a general issue with the process). Processes are further divided in file transfers and external processes.
Enfocus Switch 10 Group nodes, if present, are sorted on flow name. The order in which items are sorted within each group (or within the category if there are no groups) can be configured by clicking the column headers in the table. Columns The following table describes the columns in the Dashboard pane. You can resize and reorder the columns by dragging the column headers.
Enfocus Switch 10 Context menu item Description Retry item Retries the job or process associated with the selected row Retry group For a group row, retries all items in the associated group For an item row, retries all items in the group that contains the selected row Retry category For a category row, retries all items in the associated category For a group or item row, retries all items in the category that contains the selected row Activity monitor and workload management Health Indicator pane T
Enfocus Switch 10 • The job has an invalid file format causing a third-party application to issue a fatal error message. • The job matches none of the file filters set on the outgoing connections of a particular folder. Switch offers a number of facilities for handling problem jobs, from detecting their presence to re-injecting them in the flow after the problem has been resolved.
Enfocus Switch 10 Switch offers various ways to retry a job: • • • • When you select the Problem jobs flow element in the canvas (and it contains problem jobs), the Retry tool button is enabled. Pressing the Retry tool button retries all jobs in the selected Problem jobs flow element. The context menu for the Problem jobs flow element also offers a "Retry all jobs" menu item.
Enfocus Switch 10 Retrying problem processes The process of re-enabling a process (or at least attempting to do so) is called retrying the process. It is meaningful to retry a process only after you have fixed the problem (or at least believe you did) by reconfiguring the process, adjusting the flow design, or resolving any relevant issues outside of Switch. Automatic retry The Error Handling user preferences allow automatically retrying a problem process after a specified time interval.
Enfocus Switch 10 9. Metadata 9.1 Metadata overview What is metadata In the Switch context, metadata is descriptive information about a job (file or job folder) in a structured electronic form. Metadata is often used to store administrative information associated with a job, and to exchange such information between systems. Metadata can be distinguished from the job contents proper, even if it happens to be embedded in the job.
Enfocus Switch 10 Feature Benefits Variables Read-only access to embedded metadata (EXIF, IPTC, XMP) and file information Pick-up and export Picking up external metadata (XML, JDF, XMP) from foreign sources, and exporting it for external use Scripting Read-write access to embedded metadata and external metadata 9.2 Defining text with variables Text properties that support variables can be edited with the "Define text with variables" property editor.
Enfocus Switch 10 See Data types on page 292, Formatting on page 293, Indexed variables on page 296, and String manipulations on page 297. Entering text You can type constant text in the text field at the bottom at any time. You can also leave the field empty and just insert one or more variables using the procedures explained in the following sections. If you understand variable syntax, you can enter or modify variables directly in the text field.
Enfocus Switch 10 To insert a new variable in the text, proceed as follows: 1. In the text field at the bottom, place the text cursor in the location where you'd like to insert a variable; make sure it is not inside a pair of square brackets [ ] that mark a variable; if the text field is empty, just leave the cursor at the start of the field. 2. Select a variable group in the leftmost list ("Switch" in the example above); the list to the right adjusts to list all the variables in this group. 3.
Enfocus Switch 10 3. Once you are satisfied with the changes, press the "Update variable" button. 9.3 Defining a condition with variables Conditional properties that support variables can be edited with the "Define condition with variables" property editor. A conditional property has a Boolean result (true or false). For example, the file filtering properties on connections are conditional properties.
Enfocus Switch 10 The group and variable listboxes in the pop-up are synchronized with the corresponding dropdown menus for the currently selected comparison in the main dialog box. Defining a single comparison When the property editor for a certain property is displayed for the first time, a single comparison row is shown. To define this comparison, proceed as follows: 1. Click this button beside the first textbox. The Define text with variables pop-up dialog box appears. 2.
Enfocus Switch 10 You cannot remove the first condition since it does not have a logical operator dropdown menu. • To change the logical operator combining two comparisons: a) Locate the dropdown menu at the start of the second comparison row displaying the logical operator "AND" or "OR". b) In that dropdown menu, select the other logical operator instead; be careful NOT to select "----" because that would cause the comparison row to be removed.
Enfocus Switch 10 Variable data type Comparison operators Comparison value Integer Rational Equal to A decimal integer or floating point number, example, "-12" or "0.56" Not equal to Less than or equal A constant expression using + - * / operators; example: • 5 * 1024 * 1024 Greater than • 2/3 Greater than or equal • 6.77 + 8.55 Equal to An ISO 8601 formatted date/time (equivalent to format string "yyyy-MM-ddThh:mm:ss.
Enfocus Switch 10 3. Put connections on hold where appropriate to keep jobs from moving too far ahead (see Activating and deactivating flows on page 73). 4. Place sample jobs in the flow and let them process to the desired stage (see Viewing an active flow on page 103). 5. Deactivate the flow (see Activating and deactivating flows on page 73). 6.
Enfocus Switch 10 9.5 Building a location path The “Build location path” dialog offers assistance with building location paths for the variables in the Metadata group using picked up metadata by a sample job. The dialog supports the various data models known in Switch. See also XMP location path syntax on page 331.
Enfocus Switch 10 Metadata dataset This section lists the various datasets associated with the job. You can select the embedded dataset (which is always available, even if it is empty) or one of the external datasets associated with the job (if any). Location path syntax The data model for the selected dataset determines the available options for the location path syntax. Unavailable options are automatically disabled in the user interface.
Enfocus Switch 10 Location path For the choices “XMP/XML/JDF location path” the bottom part of the dialog displays the following two items: • An editable text field labeled “xxx location path”. • A tree view representing the metadata in the sample document, labeled “xxx data tree”. You can expand and collapse the nodes in the tree view, but the tree is not otherwise editable.
Enfocus Switch 10 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.
Enfocus Switch 10 • Reading and writing XML files and performing XSLT transforms. • Executing a command line application. • Database access. • Webservices interaction. JavaScript scripts have limited "external access". For example, there is no way to communicate with interactive applications, and there is no access to operating system services. JavaScript scripts are cross-platform, i.e. they work without change on both Mac OS X and Microsoft Windows.
Enfocus Switch 10 10.2 Putting a script in a flow Script expressions A script expression is a JavaScript program that gets evaluated in the context of a job (file or job folder) to determine the value of a particular property of a flow element or connection. This allows the property value to depend on the job or its associated metadata.
Enfocus Switch 10 Boolean value example As a second example, the "Include these files" property of a connection leaving a folder allows a script expression in addition to other filter types: Select "Define Script Expression" to enter a filter script expression in the property editor, which looks as follows: In this case, when it is evaluated in the context of the job being considered as a possible match for the filter, the script expression should return a Boolean value, i.e.
Enfocus Switch 10 • Use SwitchScripter to develop and test the script expression, and then load it into the appropriate property editor dialog box. SwitchScripter offers several advantages for working with complex script expressions.
Enfocus Switch 10 Flow element module Entry points are not supported (instead the main body of a script expression is evaluated to obtain a value). The Environment class is included except for the following functions: copy, getApplicationPath, getApplicationLicense, findRegisteredApplication, findApplicationOnDisk, getSecondsLeft, sleep.
Enfocus Switch 10 The classes and functions in the Database module offer access to a small but functional subset of the ODBC API. The DataSource class and Statement class are included. Script package A script package contains all of the information needed to execute a particular script program in the context of a script element. See scripting overview for more background information. Use the SwitchScripter development environment to create and edit script packages.
Enfocus Switch 10 a script element, and the package contains an icon, the flow designer uses the icon to display the script element in the canvas. Otherwise the flow designer uses the default script element icon. Password protection A script package can be saved with a password. This means the script package can no longer be opened in SwitchScripter (for viewing or editing) without providing the same password. However the script package can still be executed by PowerSwitch.
Enfocus Switch 10 Property definition properties Each property definition in the script declaration includes: • A tag used to uniquely identify the property to the script and its human-readable name. • The type of property editors used to enter a value for the property. • Specifications for validating the property value. See property definition properties and property editors for reference information.
Enfocus Switch 10 Language reference Refer to the Switch JavaScript language reference included with Switch help. Extensions reference Refer to the Scripting reference on page 367. AppleScript AppleScript scripting in Switch is intended primarily for communicating with other applications or with operating systems services from within Switch. A script object representing the Switch application provides access to key variables and functions, including the metadata context of the job being processed.
Enfocus Switch 10 Script packages Starting with Switch 08, SwitchScripter stores the compiled binary form of the AppleScript in the Switch script package (in addition to the source code) to avoid recompilation at execution time. This has several advantages: • It is possible to execute portions of the script that do not need the target application (such as perhaps a property validation entry point) without launching the application.
Enfocus Switch 10 end tell Referring to third-party application If the name of the target application is constant, and if it does not matter that the target application gets referenced (or sometimes even launched) when the script is first executed, the script can use the regular compile-time mechanism: tell application "QuarkXPress" … end tell Otherwise the script must use the following run-time mechanism: if … then set quarkName to "QuarkXPress" else set quarkName to "QuarkXPress Passport" end if using te
Enfocus Switch 10 Language reference Comprehensive reference and introductory information about VBScript can be found on the Microsoft web site and in widely available literature. Use the search term "VBScript" when looking for information on the web. Don't confuse VBScript with the Visual Basic programming language (a full-featured programming language and development environment offered by Microsoft) which is quite distinct from VBScript.
Enfocus Switch 10 11. Working with SwitchClient 11.1 Preparing for SwitchClient Setting up communication To enable PowerSwitch/ FullSwitch to handle connections with SwitchClient copies (running on the same computer or on another computer in the network), the system administrator should properly configure the PowerSwitch/ FullSwitch preferences and settings discussed in this topic. Note: Both FullSwitch and PowerSwitch support SwitchClient connections.
Enfocus Switch 10 Default values for bidirectional communication: Bidirectional communication (that is, Client – Server – Client communication during file submission) requires that default values can be used for returning personalized information to SwitchClient or PitStop Connect. For example: Default value(s) could be a list of order ID’s coming from an external database and visualized in a dropdown list. In this case the customers can choose one of their jobs for which they have submitted the file.
Enfocus Switch 10 Other configuration and setup Design flows In PowerSwitch/ FullSwitch, users can design the flows they want to use with SwitchClient. The next topic discusses information specific to designing a flow for use with SwitchClient. For more information, see Performing the tutorial on page 51, Workspace overview on page 32 and Working with the canvas on page 76.
Enfocus Switch 10 Since this example focuses on SwitchClient features, there is a lot of interaction with human operators and little automated processing (other than moving jobs around). Real-life flows would probably include processing steps such as preflight or color conversion. The Submit point to the left (Creatives) allows submitting jobs to the flow in a controlled fashion using SwitchClient.
Enfocus Switch 10 Setting up a Checkpoint Similarly, a Checkpoint (Visual Proof and Output Jobs in the example flow) offers properties to configure its behavior. It can cause SwitchClient to display additional information about the job, and it may require that the SwitchClient user enters additional data fields before acknowledging a job. Furthermore, the output connections of the Checkpoint determine the look of the buttons shown to the SwitchClient user for acknowledging a job.
Enfocus Switch 10 Setting up access rights To enable Submit points and Checkpoints for a particular user, the PowerSwitch/ FullSwitch user must also configure the appropriate access rights. Managing users A SwitchClient user connects to PowerSwitch/ FullSwitch through a user name and corresponding password. The user name identifies the SwitchClient user to the server and defines his/her access rights.
Enfocus Switch 10 To add a new user, click the + button and enter the user's information in the fields to the right. Providing an email address enables Switch to send notification email messages about a job to the appropriate user (email messages are sent only when this is explicitly designed into a flow). To delete a user, click the - button. Press Ctrl key to select multiple users and click the - button. A confirmation dialog box appears displaying the message This will remove multiple users.
Enfocus Switch 10 User roles Operator Operators can view their own jobs and additionally can have access rights for certain (or all) Submit points and Checkpoints. In Checkpoints routing decisions can be taken for all jobs waiting in the Checkpoint (regardless of how they got there or who submitted them).
Enfocus Switch 10 SwitchClient displays a list of Submit points through which the user can submit jobs to a flow. The settings in this section determine which Submit points can be accessed by users in the group being configured. The listbox lists all Submit points in all flows in the Flows pane. Check the ones you want to be accessible for the selected group of users. To allow users in this group access to any and all Submit points, check the All Submit points checkbox a the top.
Enfocus Switch 10 11.2 Installing SwitchClient Licensing issues Distribution SwitchClient is part of the PowerSwitch/ FullSwitch product but it has its own separate installer so that it can be easily deployed on several computers in the network. Licensing mechanism There are no license keys for SwitchClient itself; what's licensed is the number of simultaneous connections to the PowerSwitch server.
Enfocus Switch 10 3. Double-click the SwitchClient installer to launch it and follow the steps presented by the installer. Installing SwitchClient from the internet SwitchClient is part of the PowerSwitch/ FullSwitch product but it has its own separate installer so that it can be easily deployed on several computers in the network. To install SwitchClient from the internet: 1. Visit the Enfocus web site and go to the download section. 2. Download the appropriate installer for your system (Windows or Mac).
Enfocus Switch 10 Main window To keep things concise, SwitchClient has a single window that supports all its tasks. The SwitchClient window is displayed when the application is launched (by double-clicking the application icon, for example). The SwitchClient window is divided in three sections: • The topmost section displays a list of buttons; this is the tool bar. In the tool bar, there is also a filtering field which allows to filter the list of jobs shown based on a part of their name.
Enfocus Switch 10 The Search box saves the last searches and displays as a hint when typing in the search box. Filters pane The Filters pane appears at the left of the SwitchClient main window. Custom filters: SwitchClient offers Custom filters that can be added to the Jobs section. Using the Menu bar > View > New Custom Filter users can add filters and using Menu bar > View > Remove Custom Filter they can remove filters.
Enfocus Switch 10 2. Selecting Yes in the Launch at system startup pull down menu enables SwitchClient application to automatically start when the system is started. 3. Select Yes in the Display thumbnail images pull down menu to visualize thumbnail images of job cards in job list. Switch server 1. Specify the time interval (in minutes) for refreshing the information displayed in SwitchClient in Refresh interval. 2.
Enfocus Switch 10 Adding a connection To establish a new connection to a copy of PowerSwitch/ FullSwitch on your local network: 1. Press the + button at the bottom; a new line appears in the list with status “Unknown Server". 2. Complete the fields in the rightmost section; see table below; also see Preparing to run SwitchClient.
Enfocus Switch 10 3. Options to copy or move a file and options to assemble jobs when multiple jobs are submitted Listing Submit points Submit point’s icon and display name is shown on the dialog box. If no display name is available then the element name – server name – flow name is used. The Submit point can be selected from a new table dialog box by clicking the Select button. This table dialog box has five columns: Icon - Server name- Flow - Element name - Display name.
Enfocus Switch 10 When user click OK button in this dialog box, jobs are processed. If users click Cancel button in this dialog box, they are reverted to the Submit job pane. Submitting a job To submit a job to a particular Submit point: 1. Click the Submit folder or Submit file button 2. Browse for a job with the appropriate file system dialog box 3. Select a Submit point from the dropdown menu. 4.
Enfocus Switch 10 groups by checking multiple columns. The order in which the columns are checked is the order of the grouping. When un-checking a column in a multiple level grouping, the grouping is rearranged according to the order of the grouping. When users double click on a job or choose to process a job, the Individual job card is displayed.
Enfocus Switch 10 1. In the section on the left, select Alert Jobs to determine the number of jobs waiting in a Checkpoint. 2. In the list on the right, select a job for review. 3. In the rightmost section of the window, you can now: • View information fields about the job published by this particular Checkpoint.
Enfocus Switch 10 Handling jobs being held in a Checkpoint To handle a job (that is, move it along the flow) after reviewing it: • Click the button for the appropriate connection at the bottom of the job card • Select the job and click the Process button to open the Processing jobs panel • View information associated with the job in the left panel named Job Info • If the Checkpoint defines any editable data fields, complete their values in the "Metadata" section on the right named Job ticket.
Enfocus Switch 10 processed by clicking the Process all button. If only a single job is selected, the regular Process button replaces the Process all button. Note: The list of metadata fields is more dynamic. A dependent field is displayed only if a set of predefined conditions are met (similar to dependent properties in Designer). If the predefined conditions are not met, the dependent field is not displayed.
Enfocus Switch 10 As an important exception, the filename extension of the output job reflects the extension of the replacement job (so that it is possible to provide a different file type). 4. Enter metadata and handle job: Adjust metadata values as desired and then press the appropriate button to handle the replaced job. This is similar to the Checkpoint handling functionality. 5. Wait while job is being transferred. When the transfer is complete the dialog box closes automatically.
Enfocus Switch 10 • The appropriate PowerSwitch/ FullSwitch connection has been established; see connecting to Switch. • The server information has been recently updated; see updating server information. • The messages issued by all enabled connections are merged in a single list. Note: SwitchClient can no longer show log messages that have been deleted by PowerSwitch/ FullSwitch, so showing logs is also limited by the "cleanup" Application Data preferences in PowerSwitch/ FullSwitch.
Enfocus Switch 10 12. General application reference 12.1 Licensing Starting a trial off-line If the computer where you will use your software is NOT connected to the internet, you need to start your trial off-line. To start a trial off-line, do the following: 1. Create the trial request file using the Activate License Wizard / Assistant, and copy it to a machine with Internet access. See Creating a trial request on page 166. 2.
Enfocus Switch 10 6. Save the trial request file. a) Click Save As (PC) or Select... (Mac). b) In the pop-up that opens, browse to the desired location and click Save. Note: By default, the trial request file is called requesttrial.xml. 7. A message appears saying that Step 1 of the off-line trial has been completed successfully. Click Finish / Done. 8. Copy the trial request file to a computer with Internet access.
Enfocus Switch 10 2. Click Next / Continue in the first screen of the Activate License Wizard/Assistant dialog box. 3. Select Off-line activation again and click Next / Continue. 4. Select Step 2: Load an activation response and click Next / Continue. 5. Browse to the response file you copied from the machine with full Internet access and click Next / Continue. Attention: Select the response file you downloaded from the website (response.xml) and NOT the trial request file you uploaded.
Enfocus Switch 10 4. Leave Step 1: Create an activation request selected and click Next / Continue. Note: You should have created this activation account in Creating an activation account on page 20. If you have not created an activation account yet, go to http://www.enfocus.com/CreateAccount on a computer connected to the internet, and see Creating an activation account on page 20 for instructions. 5. Save the activation request file. a) Click Save As (PC) or Select... (Mac).
Enfocus Switch 10 7. Copy the response file back to the machine running Enfocus Switch and go to that machine. Loading the activation response file Once you are back at the machine running Enfocus Switch, do the following to load the activation response file: 1. Open the Activate License Wizard (on PC) or the Activate License Assistant (on Mac) by either: • going to the Trial tab of the About Enfocus Switch window and clicking Activate, or • going to Help > License > Activate . 2.
Enfocus Switch 10 4. A product key file (HTML) is created. You will need this file to activate the license for this product key on another computer. a) Click Save As / Select... to save the file. b) In the Save As dialog box, navigate to the desired location, enter a name for the file, and click Save. Make sure to note the location and name for future reference. 5. In the Save the Product Key dialog box, click Next / Continue. 6. A message appears saying the deactivation was completed successfully.
Enfocus Switch 10 Note: By default, the activation request file is called requestdeactivate.xml. 6. A message will appear saying that Step 1 of the off-line deactivation has been completed successfully. Click Finish / Done. At this point, you will not be able to run this copy of Enfocus Switch anymore. The License tab of the About Enfocus Switch window will show “Not Allowed to run (Partial deactivated License)”.
Enfocus Switch 10 2. Click Next / Continue in the first screen of the Deactivate License Wizard/Assistant dialog box. 3. Select Off-line deactivation and click Next / Continue. 4. Select Step 2: Load a deactivation response and click Next / Continue. 5. Browse to the response file you copied from the machine with full Internet access and click Next / Continue. Attention: Select the response file you downloaded from the website (response.xml) and not the deactivation request file you uploaded.
Enfocus Switch 10 4. Leave On-line Repair selected and click Next / Continue. A status bar appears while the system communicates with the activation server. After that, a message appears that the repair completed successfully and that you can now use the product(s) on your computer. 5. Click Finish / Done. Off-line repairing To repair broken licenses on a machine without Internet access, follow the same general procedure as when performing an off-line activation or deactivation.
Enfocus Switch 10 4. Verify that the product information contained in the repair request file is correct and click Continue. 5. Depending on the level of security of your Web browser, the response file (response.xml) will download automatically, or it may be blocked. If it is blocked, click the direct link to download the response file. Important: Do NOT click on the warning message at the top of your browser window then go back to the previous page and try to download the file again.
Enfocus Switch 10 Error during activation / deactivation / repair If you get the error message: “An error occurred during activation/deactivation/repair”, check the version of your FNP Licensing Service. The Licensing Wizard/Assistant works with the FNP Licensing Service on both Mac and PC. The versions of your FNP Licensing Service and of the Licensing Wizard/Assistant must match.
Enfocus Switch 10 If you are using a filesystem monitoring utility such as Radmind on the Macintosh, it can delete the configuration in the trusted storage area thinking it is empty. Make sure in the monitoring utility to exclude those directories from monitoring/cleanup/replacing.
Enfocus Switch 10 Feature LightSwitch FullSwitch PowerSwitch 1 license included 5 licenses included External metadata (XML, XMP, JDF) and writable embedded metadata Script expressions and script elements Script development environment (SwitchScripter) Scripted plug-ins (if licensed by Enfocus) Setup for SwitchClient (users pane, Submit point, Checkpoint) Connections to SwitchClient 12.
Enfocus Switch 10 Flow element LightSwitch FullSwitch PowerSwitch Set hierarchy path Job dismantler Ungroup job Split Multi- job Assemble job Generic application Execute command Tools Sort by preflight state Compress Uncompress Merge PDF Pages Split PDF in Pages Hold job Inject job Rename job 179
Enfocus Switch 10 Flow element File type Sort job Sort files in job Script element Recycle bin Communication FTP receive FTP send Mail receive Mail send Submit point Checkpoint Checkpoint via mail Pack job Unpack job Monitor confirmation 180 LightSwitch FullSwitch PowerSwitch
Enfocus Switch 10 Flow element LightSwitch FullSwitch PowerSwitch Processing Various configurators Metadata XML pickup JDF pickup XMP pickup Opaque pickup Apago PDFspy configurator Export metadata XSLT transform Log job info 12.4 Running Switch Watchdog as a service Note: Only for Microsoft Windows Switch server and Switch Watchdog Switch offers its functionality through a number of separate applications. See Switch application components on page 31.
Enfocus Switch 10 The Switch server runs in the background (without user interface) to execute flows, monitored and managed by the Switch Watchdog. In normal circumstances it is automatically started and terminated as needed by the Switch designer. Setting up Switch Watchdog as a Windows service On Microsoft Windows, the Switch Watchdog can be operated as a Windows service. This allows Switch to continue processing after you have logged off from the computer.
Enfocus Switch 10 Thus while Switch server is running without any user logged in, it cannot access mapped drives. You must ensure that all folders and file paths in the flow definitions are local drive paths or UNC paths (of the form \\server\volume\directory\file) rather than mapped drive paths. This holds for all paths including user-managed folders and references to files in configurator properties. 12.
Enfocus Switch 10 13. Advanced topics for Designing flows 13.
Enfocus Switch 10 Property Description Language environment Indicates the overall language environment in which Switch is installed; choices are Western and Japanese This setting affects the text encoding defaults for email and ZIP compression to match the legacy standards used in the selected language environment (that is, for interacting with software that does not use Unicode) Hide unavailable configurators If set to yes, configurators for unavailable applications are not shown in the Elements pane
Enfocus Switch 10 Reply email address The sender’s reply address for outgoing email messages FTP proxy preferences In case your system environment requires FTP connections to pass through a proxy server, these preferences provide Switch with the configuration details for the proxy server. In case of a proxy server, the FTP receive and FTP send tools will fail as long as these preferences have not been set.
Enfocus Switch 10 Property Description Add filename extension If set to yes, Switch ensures that all files receive a filename extension corresponding to the Mac file type and file creator codes (if these are present); for more information see the separate topic on Mac file types on page 194. Processing These preferences configure some aspects of how Switch processes jobs.
Enfocus Switch 10 Property Description Process file only after (seconds) The time for which newly arrived jobs must be stable before they are processed; to avoid picking up an input job before it has been completely written to disk, Switch ensures that the size of the file (or the total size of a job folder) has not changed for at least this amount of time before processing the job Reactivate flows upon When starting up, if this property is set to yes, Switch automatically startup reactivates flows tha
Enfocus Switch 10 Property Description Problem job arrives If set to yes, send an alert when Switch moves a job into a problem jobs folder Processing takes more than (minutes) Send an alert if a job takes more than the defined time for processing. When set to 0, this option is disabled.
Enfocus Switch 10 You can move the application data to another location by changing the value of the first preference in this group. Cleanup Some temporary application data cannot be removed automatically during regular operation. To ensure that the amount of data does not grow indefinitely, Switch performs a cleanup process at regular intervals.
Enfocus Switch 10 Property Description The name of the exported files include the Switch server name (see internal communication preferences) and the date in the format: “ logs YYYY-MM-DD.
Enfocus Switch 10 Property Description Port for Switch Watchdog The port used for communication between Switch Designer and SwitchClient Watchdog, in the range of 1 to 65535. Note: The port in the range 0 to 1023 are often managed by the IANA and are available for use only to privileged users.
Enfocus Switch 10 Show volume paths used by active flows When editing the Volume list, the Show volume paths used by active flows can be used to list all volume paths currently in use by active flows at the end of the list. By default this checkbox is turned on. Its state is remembered between uses of the property editor and across Switch sessions. If the volume path contains a user name, this will be entered in the User name field. The password is NOT added automatically.
Enfocus Switch 10 The primary output of a processor (i.e. the incoming job with any changes applied by the processor) retains the same unique name prefix as the incoming job. When a job looses its unique name prefix (for example because the “strip unique name” property is set for an archive or a final folder), it also looses the association with its internal job ticket.
Enfocus Switch 10 When a Mac OS X user copies a file from a foreign volume to a Mac-specific volume, the system looks for a matching “dot-underscore” file. If one exists, the system uses the information in the dot-underscore file to recreate the resource fork and file type attributes. If the hidden file does not exist, these attributes are not recreated.
Enfocus Switch 10 Copying files When Switch copies or moves a file under its own control (for example, between two folders), it ensures that all available Mac file type information and resource fork data is copied along with the file. (On Mac OS X this means using the native file operations; on Windows this involves supporting the emulations discussed above).
Enfocus Switch 10 Brief tutorial Regexps are built up from expressions, quantifiers, and assertions. The simplest form of expression is simply a character, example, x or 5. An expression can also be a set of characters. For example, [ABCD] will match an A or a B or a C or a D. As a shorthand we could write this as [A-D]. If we want to match any of the capital letters in the English alphabet we can write [A-Z]. A quantifier tells the regexp engine how many occurrences of the expression we want, e.g.
Enfocus Switch 10 in the regexp. A word boundary is any non-word character such as a space, a newline or the beginning or end of the string. Characters and abbreviations for sets of characters Element Meaning c Any character represents itself unless it has a special regexp meaning. Thus c matches the character c. \c A character that follows a backslash matches the character itself except where mentioned below.
Enfocus Switch 10 Character Meaning ^ The caret negates the character set if it occurs as the first character, that is immediately after the opening square bracket. For example, [abc] matches 'a' or 'b' or 'c', but [^abc] matches anything except 'a' or 'b' or 'c'. - The dash is used to indicate a range of characters, for example, [W-Z] matches 'W' or 'X' or 'Y' or 'Z'. Using the predefined character set abbreviations is more portable than using character ranges across platforms and languages.
Enfocus Switch 10 If we wish to apply a quantifier to more than just the preceding character we can use parentheses to group characters together in an expression. For example, tag+ matches a 't' followed by an 'a' followed by at least one 'g', whereas (tag)+ matches at least one occurrence of 'tag'. Note that quantifiers are "greedy". They will match as much text as they can. For example, 0+ will match as many zeros as it can from the first zero it finds, e.g. '2.0005'.
Enfocus Switch 10 Assertion Meaning \b A word boundary. For example, the regexp \bOK\b means match immediately after a word boundary (example: start of string or whitespace) the letter 'O' then the letter 'K' immediately before another word boundary (example: end of string or whitespace). But note that the assertion does not actually match any whitespace so if we write (\bOK\b) and we have a match it will only contain 'OK' even if the string is "It's OK now". \B A non-word boundary.
Enfocus Switch 10 The JavaScript programming interface for each application is documented in the application's software development toolkit which can be found on the Adobe web site. The Adobe Creative Suite bundle includes the "ExtendScript Toolkit" application which is extremely useful for developing and debugging JavaScript scripts for Adobe Creative Suite applications. The Switch configurators for the four applications mentioned above allow posting a JavaScript script to the application for execution.
Enfocus Switch 10 Writing a user script To write a user script, simply provide the JavaScript statements that should be executed in the main body of the script file. If your script encounters an error, it should set the $error variable to the appropriate error message; otherwise it should leave the $error variable alone. See below for a typical coding pattern.
Enfocus Switch 10 Variable $error Description • The empty string: each output file is moved along the outgoing connection as a separate job • The desired name of the job folder: all output files are placed inside a single job folder with the specified name If an error occurred during the execution of an earlier stage, or while preparing for the execution of this stage, this variable contains an appropriate error message: otherwise its value is null (NOT the empty string; an empty string signifies tha
Enfocus Switch 10 $error 13.7 AppleScript for applications Introduction QuarkXPress can be scripted through AppleScript (a scripting language offered by Mac OS X). The Switch configurator for QuarkXPress allows executing a user-provided AppleScript script to perform custom steps. Combined with Switch's built-in capabilities this provides powerful control of QuarkXPress.
Enfocus Switch 10 There are always five arguments because there is no mechanism to determine how many arguments are actually needed by the script. Writing an AppleScript for applications Handler The custom AppleScript must contain a run handler that takes a single argument, as follows: on run {args} ... end run Arguments When the configurator invokes the run handler, it passes a record to the single argument with useful information. The following table describes the fields in the record.
Enfocus Switch 10 Action Return value in case of success Return value in case of error Command The string "/OK/" Error message starting with "/ERROR/:" Save as Absolute path of output file or job folder (*) Error message starting with "/ERROR/:" (*) use the methods offered by the Job class (part of the Switch scripting API) to obtain a temporary output location.
Enfocus Switch 10 return scriptResult end run Command script: reverse page order in a document To reverse the page order in a document, specify the following as a custom "command" script. The script doesn't use any arguments.
Enfocus Switch 10 end tell close document 1 without saving on error errmsg number errnum set theResultJobPath to ("/ERROR/:" & errmsg) end try end tell return theResultJobPath end run 209
Enfocus Switch 10 14. Advanced topics for running flows 14.1 Scheduling jobs Objectives for scheduling jobs The Switch job scheduler has the following (sometimes conflicting) objectives, in order of importance: • Maximize overall throughput, that is, process as many jobs as possible in a given amount of time. • Allow users to specify individual job priorities: a task for a job with a higher priority should be executed first.
Enfocus Switch 10 Task category Task types in this category Maximum concurrent slots for this category Network FTP, Mail “Concurrent file transfers” preference Within each category concurrency is further limited by the serialization needs of each task type. Thus even when a slot is available for a particular category, a task in that category may not match the slot because, for example, another task of the same type is already executing and the task type has the serialized execution mode.
Enfocus Switch 10 A job priority is a signed integer number (in the range that can be represented with 32 bits). A higher number indicates a higher priority. The default priority is zero; relative to the default a priority can be higher (positive numbers) or lower (negative numbers). A job's priority can be set through one of the properties of the folder flow element and through the scripting API. 14.
Enfocus Switch 10 15. Flow element reference 15.1 Basic elements Connection Connection is a special flow element that serves to interconnect other flow elements. The network of connections in a flow determines how jobs can travel between the flow's elements.
Enfocus Switch 10 Flow element type Description Consumer Consumes jobs from a flow and possibly transports them to an outside target (such as an FTP site); a consumer does not allow outgoing connections The central role of folder At least one of the two flow elements being connected must be a folder. In other words, a flow element other than a folder can be connected only to a folder. A simple rule of thumb is "there must always be a folder in between".
Enfocus Switch 10 Property Description Corner angle Determines the layout of a connection as it is drawn on the canvas Consider the rectangle formed by drawing horizontal and vertical line segments through the center of the two flow elements being connected; the breakpoint in the connection line can be positioned anywhere on the diagonal of this rectangle The corner angle is an integer number in the range [-90, 90] inclusive; the value is a measure for how much the corner formed at the breakpoint differ
Enfocus Switch 10 Property Description Error out If set to yes, a file will move along the connection if the originating process logged at least one error Folder Folder is a central flow element that serves as an intermediary for moving jobs between other flow elements. Each folder flow element instance represents a backing folder on disk that can hold jobs before, after or in between processing steps. The contents of the backing folder can also be accessed by external processes or by users.
Enfocus Switch 10 Property Description while a "Folder nn" name is still in place, the flow element automatically adopts the name of the backing folder Path The path of the folder's backing folder on disk, or "auto-managed" Leave originals in place If set to yes, incoming jobs are left untouched in the folder; Switch never writes to the folder so read-only access rights suffice; see Leaving originals in place on page 90 for more details If set to no (the default), incoming jobs are moved out of the fo
Enfocus Switch 10 Property Description Relative to Determines whether the day of the month is relative to “Start of month’” or “End of the month” Attach hierarchy info If set to yes, the folder’s name is added to each job’s hierarchy location path as the job passes through the folder; see Using hierarchy info on page 91 for more details Add name at the top If set to yes, the folder name is added at the top of the hierarchy location path; otherwise it is added at the bottom Attach email addresses T
Enfocus Switch 10 Property Description Ignore these subfolders All subfolders that match the specified folder filter are ignored for the purpose of counting the number of jobs residing in this folder This property appears only when the folder’s outgoing connection leads to a generic application; if that application stores information in subfolders inside its input folder, this property allows Switch to ignore these folders and their contents Backing folders The backing folder (on disk) for a folder can
Enfocus Switch 10 leaving the others in the problem jobs folder. In any case be careful to avoid endless loops of jobs that fail over and over again. The problem jobs tool supports only one outgoing connection. To overcome this limitation, connect it to a regular folder from which you can originate as many connections as you like.
Enfocus Switch 10 • • • input hot watched Connections Submit hierarchy does not allow incoming connections. Submit hierarchy injects folder filter properties into its outgoing connections so that it is possible to include/exclude certain subfolders in the hierarchy for particular connections. Also see the "skip folders" property described below. Note: The number of eligible jobs for processing is shown in a small rectangle to Submit hierarchy element.
Enfocus Switch 10 Property Description Allow from (hh:mm) The time-of-day window during which to detect jobs; the values are structured as "hh:mm" (hours, minutes) indicating a time of day on a 24 hour clock; an empty value means midnight; two identical values mean the submit hierarchy always detects jobs Allow to (hh:mm) Day-of-week window If set to yes, the submit hierarchy detects (and moves) newly arrived jobs only during certain days of the week (specified in the subordinate properties) Allow f
Enfocus Switch 10 Property Restriction Description Defines an optional restriction on the parent or ancestors for the folder in this rule. Options available are: • None (default) • With immediate parent named • With no immediate parent named • With any ancestor named • With no ancestor named Parent name or Ancestor name A pattern for the folder name of the parent or ancestor Nesting Only available if Attach hierarchy info is enabled.
Enfocus Switch 10 Property Description Starting from this level The number of upper levels for which not to cleanup subfolders Archive hierarchy Archive hierarchy is a consumer that creates a nested hierarchy with one or more levels of subfolders. It is used to archive jobs into a structured hierarchy at the end of a flow. The resulting jobs are to be consumed (and removed) by an external process. The backing folder (on disk) for an archive hierarchy should typically be user-managed.
Enfocus Switch 10 Property Description leaving the prefixes in place avoids overwriting a previously deposited job with the same name Duplicates Determines what happens when "Strip unique name" is set to yes and a job arrives with the same name and location as a job already residing in the hierarchy: • Overwrite: replace the existing job with the new one – this is the default behavior • Keep unique name: preserve the new job’s unique name prefix, leaving the existing job untouched (without unique name
Enfocus Switch 10 Property Description Action Determines how to combine the new segments with the existing hierarchy location path: • Replace: replace any existing hierarchy location path by the path formed by the new segments Path segment 1 … Path segment 5 • Add at the top: add the new segments at the top of the existing hierarchy location path • Add at the bottom: add the new segments at the bottom of the existing hierarchy location path • Remove: remove one or more segments from the existing
Enfocus Switch 10 Connections Job dismantler injects folder filter properties into its outgoing connections so that it is possible to include/exclude certain subfolders in the incoming job folders for particular connections. Also see the "skip folders" property described below.
Enfocus Switch 10 Keywords Keywords can be used with the search function above the Elements pane. The keywords for the Ungroup job element are: • hierarchy • folder • subfolder • ungroup • group • assemble • disassemble Usage examples • Split a multi-page PDF file in separate pages; process each page separately through one or more applications that can deal only with a single page at a time; recombine the pages in a job folder; merge the pages into a single PDF file.
Enfocus Switch 10 Private data key Stored value .FilePath The relative path of this file within the parent job folder Split Multi-job Related Adobe InDesign or QuarkXPress jobs are often stored in a single job folder with multiple “main” files at the top level and shared resources (such as images and fonts) in subfolders. The Switch configurators for these applications however expect a single main file in each job folder, so these “multi-job folders” cannot be processed without change.
Enfocus Switch 10 Assemble job is a processor that offers various schemes for assembling a job folder from individual job files. Keywords Keywords can be used with the search function above the Elements pane. The keywords for the Assemble job element are: • hierarchy • folder • subfolder • ungroup • group • assemble • disassemble • build Connections Assemble job supports outgoing traffic-light connections of the following types: • Data success: carries successfully assembled jobs.
Enfocus Switch 10 Property Description previous assembly was completed; a value of 0 means this option is disabled After N minutes Displayed when Shceme is Arbitrary files or Custom. A job is completed whenever more than the indicated time has expired since the first job in this assembly arrived; a value of 0 means this option is disabled Number index for total Displayed when Shceme is Numbers in filename.
Enfocus Switch 10 Property Description The string is used only for the purpose of determining which jobs belong together; it has no other meaning Complete condition A job (using Custom scheme) is completed if this condition is true, even if the required number of jobs hasn’t arrived. The condition is re-evaluated for each newly arrived job in the context of that job. A value of None means this option is disabled.
Enfocus Switch 10 Property Orphan timeout (minutes) Description • Add version number: add an incrementing version number at the end of the filename body for the new job ( “2”, “3”, … “9”, “10”, “11”), leaving the existing job untouched • Fail: move the new job to the problem jobs folder, leaving the existing job untouched The time delay after which incoming jobs are considered orphaned because they are not part of a completed job Incoming jobs remain in their respective input folder until the last jo
Enfocus Switch 10 • the input folder can only have one outgoing connection • the connection cannot be set on hold. • the generic application tool can only have one incoming connection. Keywords Keywords can be used with the search function above the Elements pane.
Enfocus Switch 10 Execute command is a processor that executes a system command or a console application with the specified command-line arguments and output mechanisms. Keywords Keywords can be used with the search function above the Elements pane.
Enfocus Switch 10 Properties Copy input job Description • Result next to input job: the command places the output next to the input job (i.e.
Enfocus Switch 10 15.2 Tools Compress Compress is a processor that places the incoming file or a job folder into a compressed ZIP archive. All files in a job folder are placed in a single archive. The archive is named as the incoming file or job folder with a “.zip” extension. Keywords Keywords can be used with the search function above the Elements pane. The keywords for the Compress element are: • ZIP • archive Connections Compress allows only a single outgoing connection.
Enfocus Switch 10 • ZIP • RAR • MIME Any files that are not recognized as an archive are passed through the uncompress tool without change. Keywords Keywords can be used with the search function above the elements pane. The keywords for the Uncompress element are: • ZIP • RAR • MIME • archive • compress • decompress • unzip Filenames and folder structure The following table describes the resulting file or folder structure and the corresponding naming conventions.
Enfocus Switch 10 Property Description The script expression can be used to determine a password dynamically, for example based on the sender of the packed data Remove redundant folders If set to yes, for archives where the files or job folders are contained in deeply nested subfolder structures, removes all but the deepest subfolder level while uncompressing Example: A PDF file that is compressed as "Folder 1\Folder 2\Folder 3\Test.pdf" is uncompressed as "\Folder3\Test.
Enfocus Switch 10 Switch metadata The Merge PDF tool processes a job folder, so Switch metadata is derived from that folder and not from the individual PDF files. PDF version The merged PDF will have the highest PDF version number. Example: Merge two files, one PDF version 1.4 and the other PDF version 1.6, the result will be PDF version 1.6. Merge Order The tool will merge the files in increasing alphabetical order of file name.
Enfocus Switch 10 Incoming files Ordering • 04 Booklet iv.pdf • 05 Booklet 1-1.pdf However, because the page index (including the leading zeroes) appears early in the file name, the alphabetical order will put the pages in the same order as before splitting • ... • 10 Booklet 1-6.pdf • 11 Booklet 2-1.pdf • ... • 15 Booklet 2-5.
Enfocus Switch 10 File naming For each incoming PDF file, the tool creates a job folder that contains the PDF files resulting from splitting the incoming PDF file into sections of one or more pages. The files are named by adding a prefix and/or suffix to the incoming file’s name.
Enfocus Switch 10 Property settings Resulting files • Prefix = "" • Booklet pages 03-04 of 15.pdf • Suffix = " pages [index]-[LastIndex] of [Total]" • ... • Booklet pages 15-15 of 15.pdf • Pages per file = 1 • 01 Booklet i.pdf • Prefix = "[Index]" • 02 Booklet ii.pdf • Suffix = "[Label] • 03 Booklet iii.pdf • 04 Booklet iv.pdf • 05 Booklet 1-1.pdf • ... • 10 Booklet 1-6.pdf • 11 Booklet 2.1.pdf • ... • 15 Booklet 2-5.
Enfocus Switch 10 Properties Properties Description Job priority The priority assigned to each incoming job; jobs with higher priority are released first; a greater number indicates a higher priority Default means: use the job priority defined in the job ticket The value of this property is converted to a floating point number; the Boolean value True and string values that commonly represent True convert to 1, the Boolean value False and any string values that don’t represent a number or True convert to
Enfocus Switch 10 Property Description Maximum folder size (MB) This connection receives a job as long as its target folder’s size does not exceedthis limit after adding the job; a zero value means this constraint is disabled Target folder The absolute path of the folder that should be checked for job count and/or size; Default means the connection’s target folder Note: Whenever a job arrives in the Hold job tool, Switch checks the Target folder.
Enfocus Switch 10 1. Determine J, the set of eligible jobs, to include all incoming jobs that have fully arrived and that have waited for at least the delay specified for the job (if any). 2. If J is empty, there are no jobs to be moved – terminate. 3. Sort the jobs in J on priority (higher priority first) and within the same priority on arrival stamp (earliest arrival first). 4. For each job in J, in the sorted order, perform these steps: a. Consider A to be the set of outgoing connections. b.
Enfocus Switch 10 Properties Property Description Name The name of the flow element displayed in the canvas Outgoing connection properties The following properties are provided for each of the outgoing connections in addition to the basic connection properties Property Description Trigger Specifies the type of event that triggers injection for this connection: • Incoming job: an injection is triggered for each incoming job • Time since previous job: an injection is triggered when the specified peri
Enfocus Switch 10 Property Description Job path The absolute file or folder path of the job to be injected (if a fixed file path is selected, the selected file is included in the exported flow) Job repository The absolute folder path of the repository containing the jobs Job name The file or folder name of the job residing in the repository (possibly including the filename extension, depending on the value of the subsequent property) Extension The filename extension for the job residing in the rep
Enfocus Switch 10 • • • suffix regular expression regexp Connections Rename job allows only a single outgoing connection.
Enfocus Switch 10 Property Description (that is, a single digit unless there are many files colliding to the same name) Action 1 Act on Determines the first rename action taken: • None • Add prefix • Add suffix • Remove segment • Keep segment • Replace • Search and replace • Reduce character set • Remove extension • Add extension • Replace extension Determines which portion of the filename is affected: • Filename proper • Prefix The prefix to add at the start of the filename Suff
Enfocus Switch 10 Property Description • Replacement character Portable ASCII: printable 7-bit ASCII less those characters that aren’t allowed in filenames on some systems Determines the replacement for disallowed characters: • Underscore • Space • Remove New extension The new filename extension Action 2 … Action 5 The subsequent rename actions taken; these properties have the same subordinate properties as the first action property Restoring the original filename If the "Remember original name
Enfocus Switch 10 The keywords for the File type element are: • replace • filename • name • extension Connections File type allows only a single outgoing connection.
Enfocus Switch 10 Properties Property Description Name The name of the flow element displayed in the canvas Scheme Determines the scheme used to specify a metadata value: • Direct: use variables or a script expression to calculate a value • Location path • Key/value pair Value The value to be used for sorting the job Dataset The name of the metadata dataset to query; Default means the embedded dataset Data model The data model used for querying the dataset (one of XMP, JDF, XML); this must ma
Enfocus Switch 10 The keywords for the Sort files in job element are: • remove • add • replace • order • filename • name • extension Connections Sort files in job allows only a single outgoing connection.
Enfocus Switch 10 Property Description Rename scheme Determines the rename action taken to make files collate: • Add prefix Prefix pattern • Add prefix and suppress digits: each digit group in the original filename is replaced by an underscore • Replace filename (leave extension) • Replace filename and extension A pattern for the prefix; “count” is replaced by a number with an appropriate number of digits (depending on the number files) Sort by Preflight State Sort by Preflight State is a proc
Enfocus Switch 10 • PDF files that are not Certified PDF Script element Script is a flow element that executes a script program specified by the user to process, produce or consume jobs. A script flow element can be a processor, producer or consumer depending on the specifications in the attached script declaration. In addition, the script declaration may inject extra properties into the script element and into its outgoing connections. These extra properties serve as arguments to the script program.
Enfocus Switch 10 Properties Property Description Name The name of the flow element displayed in the canvas Script package The Switch script package to be attached to this script element The script declaration may define extra properties to be injected into the script element as arguments for the script program Recycle bin Recycle bin is a consumer that deletes incoming jobs either immediately or depending on the jobs size, age etc...
Enfocus Switch 10 Property Description are then deleted until the total size of the jobs in the recycle bin is once again under the limit The "Save..." properties of the recycle bin tool are independent; jobs are deleted as soon as they exceed the limit of any of the "Save...
Enfocus Switch 10 • download Connections FTP receive does not allow incoming connections. FTP receive injects folder filter properties into its outgoing connections so that it is possible to include/exclude certain subfolders in the incoming job folders for particular connections. Also see the "skip folders" property described below.
Enfocus Switch 10 Property Description for workflows where the input job is replaced by the processing result, to avoid triggering endless loops. If set to no, the job will be reprocessed when its file size or modification date is different. This allows processing jobs which have the same file name as previously submitted jobs. Minimum file size (KB) Used to set the minimum file size (in KB) limit before Switch picks up the files or folders. To set no limits, leave it empty.
Enfocus Switch 10 Property Description • The Folder name used for matching • The Levels, limiting the range of subfolder levels on which the rule applies • A Restriction, based on the folder name of the parent or ancestors for the folder. If folder Y contains subfolder X; Y is X's parent folder. If folder Z contains subfolder Y; Z is one of X's ancestors. The folder that contains folder Z is also one of X's ancestors, and so on.
Enfocus Switch 10 Keywords Keywords can be used with the search function above the Elements pane. The keywords for the FTP send element are: • Internet • web • FTP • SFTP • network • communication • transfer • output • upload Connections FTP send supports optional outgoing connections to provide in-flow feedback about the operation and to keep the job around without extra copying.
Enfocus Switch 10 Property Description Transfer as binary If set to yes, FTP receive transfers files as binary, otherwise it transfers them as ASCII User name The login name for the FTP server. For anonymous login, use "anonymous" as user name Password The password for the FTP server. For anonymous use, enter an email address as password. FTP directory The directory on the FTP site to which jobs are to be delivered.
Enfocus Switch 10 Mail receive is a producer that retrieves email messages from a POP3 and IMAP email server (so that users can access email accounts like Gmail, Hotmail etc) and injects any file attachments into the flow. Please note that Switch only accepts MIME encoded attachments. Keywords Keywords can be used with the search function above the Elements pane.
Enfocus Switch 10 Property Description Time-of-day window If set to "Yes", the tool checks for new arrivals only during a certain time of the day (specified in the subordinate properties) Allow from (hh:mm) The time-of-day window during which to check for new arrivals; the values are structured as "hh:mm" (hours, minutes) indicating a time of day on a 24 hour clock; an empty value means midnight; two identical values mean the tool always checks for new arrivals.
Enfocus Switch 10 Property Base map key on Email info map Scan for nested attachments Collect attachments Assemble message and attachments Inject message as file Description Defines the "key" that is used to select the appropriate email info from the table provided in the next property; the key can be contents of: “Sender’s email address”, “Email account name”, or “Message subject” Email addresses and body text specified with the editor for this property are added to each file's email info as the fil
Enfocus Switch 10 Refer to Email message schema on page 319 for details on the format of the generated metadata. Mail send Mail send is a processor (although conceptually it is a consumer) that sends an email message to an SMTP email relay server for each incoming job. Some properties for this tool (such as the SMTP server details) are setup as a global user preference since these values are always the same for all outgoing email.
Enfocus Switch 10 Properties Property Description Name The name of the flow element displayed in the canvas Subject The subject line for the message. To addresses The list of destination email addresses for the message. Email addresses are separated by a semicolon or by a newline. Include attached addresses If set to "Yes", the email addresses from the job’s internal job ticket are added to the To addresses.
Enfocus Switch 10 Property Description Attach files If set to "Yes", the incoming file or job folder is compressed (zipped) and attached to the email message being sent.
Enfocus Switch 10 Property Description Attach hierarchy info If set to "Yes", part of a job’s submit information (as configured with the next two properties) is added to its hierarchy location path as it is injected in the flow; see Using hierarchy info on page 91 for more details Include Submit point name If set to "Yes", the name of this flow element is included at the top of the remembered location path Include user name If set to "Yes", the name of the user submitting the job is included in the
Enfocus Switch 10 Checkpoint is a processor that holds jobs for human intervention. A SwitchClient user with the appropriate access rights can review jobs in a Checkpoint and redirect them along any of the Checkpoint’s outgoing connections. See Working with Checkpoints . The name shown to the SwitchClient user for each outgoing connection is the name of the connection, or if it is empty, the name of the target folder. The backing folder for a Checkpoint is always auto-managed.
Enfocus Switch 10 Property Description Allow replacing job If set to yes, SwitchClient displays an extra button that allows the user to edit and/or replace jobs with a new version (presumably edited on the client user's computer) before moving it out of the Checkpoint; the original job is lost, but its metadata is preserved See Replacing a job on page 163 for more information on the replacement process Require metadata entry If set to yes, the SwitchClient user is asked to complete metadata fields bef
Enfocus Switch 10 Picking up client fields as metadata The Checkpoint tool picks up metadata fields entered by the SwitchClient user when moving along a job. Specifically, when a user moves along a job residing in a Checkpoint and the list of editable field definitions in the Checkpoint's “Metadata fields” property is nonempty, the Checkpoint creates a metadata dataset and associates it with the job’s job ticket under the specified dataset name.
Enfocus Switch 10 Properties Property Description Name The name of the flow element displayed in the canvas Subject The subject line for the message. To addresses The list of destination email addresses for the message. Email addresses are separated by a semicolon or by a newline. Include attached addresses If set to yes, the email addresses from the job’s internal job ticket are added to the To addresses. Reply address The email address to which a receiver of the message should send a reply.
Enfocus Switch 10 Property Description Server address The URL or IP address of the server from which to retrieve email Accounts A list of accounts (names and corresponding passwords) from which to retrieve email Use secure password verification Defines whether to log in to the email server using secure password verification Server requires secure connection (SSL) Defines whether the email server requires a secure connection using the SSL protocol Check every (minutes) The frequency of checking t
Enfocus Switch 10 Reply from user Job identifier: 0044P Action: Accept ... Pack job Pack job is a processor that packs a job and its associated metadata for transmission. The result is always a single ZIP file that contains a globally unique identifier to identify it across multiple Switch instances. Pack job also stamps the internal job ticket of its output with the unique identifier so that confirmations can be matched with the packed data without opening the ZIP file.
Enfocus Switch 10 Property Description Include external metadata If set to "Yes", the output archive contains a copy of the external metadata (that is, all datasets) associated with the job Embedded metadata is always included since it is part of the job file itself Compress If set to yes, the data in the output archive are compressed (the default behavior) If set to no, the data are stored in the output archive without compression, dramatically reducing processing time; this can be meaningful when sp
Enfocus Switch 10 Connections Unpack job supports outgoing traffic-light connections of the following types: • Data success: carries successfully unpacked jobs, with restored metadata. • Log success (optional): carries confirmation file that should be returned to the sender of the packed job. • Data error (optional): carries incoming jobs that cannot be unpacked; if there is no such connection, these jobs are moved to the problem jobs folder.
Enfocus Switch 10 Property Description Keep info for (days) The list of identifiers already processed is kept for at least this many days Monitor confirmation Monitor confirmation is a processor that monitors incoming receipt confirmations (generated by Unpack job) and matches them against a copy of the packed data (generated by Pack job) waiting in its input folder.
Enfocus Switch 10 Action Connection type Comments Error log When a confirmation is received that does not match any of the waiting packed data files or that is corrupt, it is sent along this connection Properties Property Description Name The name of the flow element displayed in the canvas Retry count The number of retry attempts made when no confirmation is received Retry delay (minutes) The delay (in minutes) between each retry attempt and the timeout after the last one 15.
Enfocus Switch 10 The keywords for the XML pickup element are: • metadata • dataset • asset Data model The metadata source must be a well-formed XML file with any schema. The dataset data model is XML. Connections XML pickup allows only a single outgoing connection.
Enfocus Switch 10 The keywords for the JDF pickup element are: • metadata • dataset • asset • ticket • adticket Data model The metadata source must be a JDF file conforming to the JDF 1.3 specification. The dataset data model is JDF. Connections JDF pickup allows only a single outgoing connection.
Enfocus Switch 10 • Metadata alongside asset • Metadata in job folder asset • Metadata is asset Keywords Keywords can be used with the search function above the Elements pane. The keywords for the XMP pickup element are: • metadata • dataset • asset • ticket • adticket Data model The metadata source must be an Adobe XMP packet or a standalone XMP file conforming to the Adobe XMP specification dated June 2005. The dataset data model is XMP.
Enfocus Switch 10 • Interpret the file format’s structure to track down the packet: this guarantees that the correct packet has been located and it is usually much faster, but it requires a specific algorithm for each distinct file format. The XMP pickup tool interprets the file format for a number of supported file formats, and scans the complete file for all other file formats.
Enfocus Switch 10 Additional properties are shown depending on the selected pickup mechanism; see the description of each mechanism for more information. Apago PDFspy This configurator drives Apago PDFspy 1.0. It is a processor that tells PDFspy to dump a number of statistics about a PDF file in an XML file, and then picks-up that XML file as metadata that gets associated with the PDF file's internal job ticket. The PDF file itself remains unchanged.
Enfocus Switch 10 • License Apago PDFspy as described in its documentation, using a valid license key obtained from Apago or from an authorized reseller (Enfocus does not sell or distribute third-party software). If you skip this step you can use Apago PDFspy in trial mode for a limited amount of time. • Start Switch; in the elements pane (NOT in the canvas) right-click on the Apago PDFspy icon; in the resulting context menu select the "set path to application...
Enfocus Switch 10 Property Description XMP packet In/exclude a complete copy of the XMP packet embedded in the PDF file, if any, with the statistics (XMP) Export metadata Export metadata is a processor that allows saving a metadata dataset associated with the incoming job to a standalone file. The tool merely copies the dataset’s backing file to the output location without any transformations. The XSLT transform on page 288 tool can be used to transform the exported metadata if needed.
Enfocus Switch 10 Property Description Opaque data model, the original backing file’s filename extension is used) XSLT transform XSLT transform is a processor that performs an XSLT 1.0 transformation on the incoming XML file and produces the resulting XML, HTML or text file. Refer to the XSLT 1.0 specification and to widely available literature about XSLT for more information. See also External metadata on page 314. Keywords Keywords can be used with the search function above the Elements pane.
Enfocus Switch 10 Log job info is a processor that issues a message to the Switch execution log containing the value of the specified metadata field. It is intended mainly for use while testing a flow. Keywords Keywords can be used with the search function above the Elements pane. The keywords for the Log job info element are: • metadata • debug Connections Log job info allows only a single outgoing connection.
Enfocus Switch 10 16. Metadata reference 16.1 Variables Using variables Switch allows the use of variables in the values of many text properties and for defining file filters. A variable is a special, well-recognizable text string that gets replaced by a dynamic value when the flow is being executed. The dynamic value is recalculated each time in the context of the job being processed.
Enfocus Switch 10 Using sample jobs The variable-related property editors (Defining text with variables and Defining a condition with variables) offer a mechanism to select a sample job and to display actual metadata values derived from that job while you are configuring (portions of) the property value in the editor. The Build location path dialog offers assistance with building location paths for the variables in the Metadata group using actual metadata associated with a sample job.
Enfocus Switch 10 See Indexed variables on page 296. Basic syntax Variable name In its simplest form, a variable is specified as follows: [Group.Variable] The variable name is surrounded by square brackets. Whitespace is not allowed in the variable specification. Variable names contain two segments separated with a period. The first segment is the group name; the second segment is the variable name within the group.
Enfocus Switch 10 Data type Description Text Text string Alt Text Possibly localized text string (that is, there may be multiple language versions) Switch always uses the default language; so this data type is equivalent to Text Text Indexed List of items of type Text (see indexed variables) Boolean Boolean value true or false Integer Integer number Rational Rational number formed by division of two integers Date A moment in time, including date and/or time information See also: • Basic syn
Enfocus Switch 10 Data type Date Description of data type /Formatting argument Representation as a text string Precision="integer" Decimal floating point representation with the specified number of digits after the decimal point (minimum precision is 1, max is 15) A moment in time, including String representation in the subset of the ISO date and/or time information 8601 format allowed in XMP Date fields (see Adobe XMP specification, version dated September 2005, page 75) Equivalent to format string
Enfocus Switch 10 Expression Output ss the second with a leading zero (00 to 59) z the milliseconds without leading zeroes (0 to 999) zzz the milliseconds with leading zeroes (000 to 999) AP use AM/PM display; AP will be replaced by either "AM" or "PM" ap use am/pm display; ap will be replaced by either "am" or "pm" '...
Enfocus Switch 10 • Then the value is converted to the data type appropriate for the comparison type (example: string, number, ...); as indicated in the table above. See also: • Basic syntax on page 292 • Data types on page 292 • Formatting on page 293 • Indexed variables on page 296 • String manipulations on page 297 Indexed variables Some variables access a list of values rather than a single value. These variables are called indexed variables.
Enfocus Switch 10 Text in a property value Evaluates to [Job.EmailAddress:Separator=", pipo1@enfocus.com, pipo2@enfocus.com "] The email addresses for this job are: The email addresses for this job are: - pipo1@enfocus.com pipo2@enfocus.com [Job.
Enfocus Switch 10 Argument Value Result Search Regular expression (use anchors to match start or end of string) The first substring that matches the regular expression See also: • Basic syntax on page 292 • Data types on page 292 • Formatting on page 293 • Comparing on page 295 • Indexed variables on page 296 Known variables Switch offers a library of variables organized in groups, as listed in the table below.
Enfocus Switch 10 Group Type of information Source Connection Client connection attributes like user name, IP, user role Switch settings, system environment Doc group These variables access embedded metadata fields in the Adobe XMP format. The third column indicates the XMP location path for the variable in the XMP data model. The metadata fields accessed by the variables in this table can be viewed and edited using the "File > File Info..." dialog in Adobe Creative Suite applications.
Enfocus Switch 10 Variable name Data type XMP location path Acrobat Photoshop File Info DocumentProperties label label Doc.Credit Text photoshop:Credit Doc.DateCreated Date photoshop: DateCreated Created Origin / Date Created Doc.Description Alt Text dc:description Subject Description / Description Origin / Credit IPTC Status / Provider Doc.DescriptionWriter Text photoshop: CaptionWriter Description / Description Writer Doc.Format Text dc:format Description / Format Doc.
Enfocus Switch 10 The Mail receive flow element associates this information with the job as a metadata dataset. Refer to Email message schema on page 319 for details on the format of this metadata. The third column in the table lists the element name in this schema corresponding to each variable. (*) See email message schema. Variable name Data type Element name (*) Email.Body Text body Email.Cc Text cc Email.Date Text date Email.From Text from Email.MessageId Text message-id Email.
Enfocus Switch 10 Variable name Data type XMP location path TIFF tag Image.Orientation Integer tiff:Orientation 0x0112 Image.PhotometricInterpretation Integer tiff:Photometric Interpretation 0x0106 Image.ResolutionUnit Integer tiff:ResolutionUnit 0x0128 Image.SamplesPerPixel Integer tiff:SamplesPerPixel 0x0115 Image.Software Text tiff:Software & xmp:CreatorTool 0x0131 Image.XResolution Rational tiff:XResolution 0x011A Image.
Enfocus Switch 10 Variable name Data type XMP location path (*) Photoshop File Info label Iptc.Creator Text dc:creator/*[1] IPTC Contact / Creator Iptc.CreatorJobTitle Text photoshop:AuthorsPosition IPTC Contact / Creator’s Job Title Iptc.DateCreated Date photoshop:DateCreated IPTC Image / Date Created Iptc.Description Alt Text dc:description IPTC Content / Description Iptc.DescriptionWriter Text photoshop:CaptionWriter IPTC Content / Description Writer Iptc.
Enfocus Switch 10 Variable name Data type Scripting API equivalent Job.Extension Text Job.getExtension() Job.FileCount Integer Job.getFileCount() Job.Hierarchy Text Indexed Job.getHierarchyPath() Job.IsFile Boolean Job.isFile() Job.IsFolder Boolean Job.isFolder() Job.JobState Text Job.getJobState() Job.Name Text Job.getName() Job.NameProper Text Job.getNameProper() Job.Path Text Job.getPath() Job.Priority Integer Job.getPriority() Job.PrivateData Text Job.
Enfocus Switch 10 The variale [Job.NestedName:Prefix="-> ",Indent=". "] might be replaced by the following lines: -> -> -> -> -> -> My job folder . First.pdf . Second.pdf . Subfolder . . Readme.txt . Third.pdf The following variables access a job's occurrence trail to provide information on the job's origin and on why the job was sent to the problem jobs folder. Each of the variables access the most recent occurrence of a particular type, as listed in the table.
Enfocus Switch 10 Argument Value Dataset The name of the external dataset to be accessed, or empty/missing to indicate the embedded dataset Model The data model used for querying the data set; when empty/missing the data model is derived from the dataset; allowed values are “XML”, “JDF” and “XMP” This argument can be omitted except when forcing a JDF data model to be queried using regular XML semantics (that is, using “evalToString” rather than “getString”) Path The location path or expression for s
Enfocus Switch 10 Variable name Data type XMP location path EXIFF tag Photo.Contrast Integer exif:Contrast 0xA408 Photo.CustomRendered Integer exif:CustomRendered 0xA401 Photo.DateTimeDigitized Date exif:DateTimeDigitized 0x9004 & 0x9292 Photo.DateTimeOriginal Date exif:DateTimeOriginal 0x9003 & 0x9291 Photo.DigitalZoomRatio Rational exif:DigitalZoomRatio 0xA404 Photo.ExposureBiasValue Rational exif:ExposureBiasValue 0x9204 Photo.
Enfocus Switch 10 Variable name Data type XMP location path EXIFF tag Photo.Lens Text aux:Lens -- Photo.LightSource Integer exif:LightSource 0x9208 Photo.MaxApertureValue Rational exif:MaxApertureValue 0x9205 Photo.MeteringMode Integer exif:MeteringMode 0x9207 Photo.PixelXDimension Integer exif:PixelXDimension 0xA002 Photo.PixelYDimension Integer exif:PixelYDimension 0xA003 Photo.Saturation Integer exif:Saturation 0xA409 Photo.
Enfocus Switch 10 Variable name Data type Supported for Stats.NumberOfPages Integer All supported formats Stats.SamplesPerPixel Integer JPEG, TIFF, PNG Stats.PixelXDimension Integer JPEG, TIFF, PNG Stats.PixelYDimension Integer JPEG, TIFF, PNG Stats.ColorMode Integer JPEG, TIFF, PNG Stats.ColorSpace Integer JPEG, TIFF, PNG Stats.ICCProfile Text JPEG, TIFF, PNG Stats.Colorants Text Indexed TIFF Stats.CellWidth Integer TIFF Stats.CellLength Integer TIFF Stats.
Enfocus Switch 10 Variable name Data type Supported for Stats.TrimBoxWidth Integer PDF Stats.TrimBoxHeight Integer PDF Stats.ArtBoxWidth Integer PDF Stats.ArtBoxHeight Integer PDF Stats.PDFXVersionKey Text PDF Stats.ColorSpaceFamilies Text Indexed PDF Stats.TransparentColor Boolean PDF Stats.FontTypes Text Indexed PDF Switch group These variables are Switch-specific. The third column indicates the scripting API function that returns the variable's dynamic value.
Enfocus Switch 10 to “00001”. Next time, it will evaluate to “00002” and so forth. After the counter reaches “99999” it circles back to “00000”. The most recently used value of the counter is retained across multiple invocations of the Switch server. Counter: number of digits The Width argument specifies the number of decimal digits in the number; leading zeroes are inserted when needed. The default value for width is 5; the minimum value is 1 and the maximum value is 15.
Enfocus Switch 10 Format Description Reference EXIF A binary format designed to store information about a photograph Exif Version 2.
Enfocus Switch 10 Supported file formats The following table lists the embedded metadata capabilities for the supported file formats. File format Metadata access JPEG, TIFF XMP packet handling EXIF & IPTC synchr. Image data synchr.
Enfocus Switch 10 • Locate the primary embedded XMP packet and parse it into an XMP object model; if there is no XMP packet start with an empty XMP object model. • Read the appropriate binary EXIF and IPTC tags, if present and merge their values into the XMP object model as the equivalent XMP properties. • Offer access to the resulting unified XMP object model.
Enfocus Switch 10 Picking up metadata Switch allows permanently associating metadata with a job moving through the flow (by storing a reference to it in the job's internal job ticket). Each distinct set of metadata fields (for example, a JDF job ticket or an XMP packet) are stored in a separate metadata dataset. Switch supports several types of datasets, each with a specific data model that determines the semantics for querying values from the dataset. See below for information on supported data models.
Enfocus Switch 10 Data model Description Query mechanism Scripting API XML Any well-formed XML file (with or XPath 1.0 Dataset class, XML without XML namespaces); refer to the expression and/or data model XML 1.0 specification location path JDF A JDF file conforming to the JDF 1.3 specification XPath 1.
Enfocus Switch 10 Source Pickup tool Data model Default dataset name Professional configurator (with XML report); then XML pickup Text log or PDF preflight report Any configurator with outgoing traffic Opaque light connections (set the "carry this type of files" property to "data with log") Log Pickup mechanisms The metadata pickup tools (XML pickup, JDF pickup, XMP pickup) allow associating metadata from various sources as a metadata dataset with a job’s internal job ticket.
Enfocus Switch 10 Metadata in job folder asset The asset (which is always a job folder) is placed in one of the pickup tool’s input folders and the metadata source (which is always a single file) resides inside the job folder. The pickup tool provides flow element properties for locating the metadata source within the job folder (nesting level and filename pattern).
Enfocus Switch 10 Property Description Asset path A script expression that evaluates to the file or folder path referring to the asset to be copied (*) Delete asset Determines whether the original copy of the asset is deleted after it has been copied into the flow; this can be an explicit value or a script expression (*) (*) Usually script expressions are evaluated in the context of an incoming job before the tool acts on the job.
Enfocus Switch 10 to, cc, and reply-to addresses and the complete email body text. This dataset is then associated with the job ticket for all files delivered by the message under the standard dataset name “Email”. Data model and schema The email message dataset uses the XML data model with a simple schema without namespaces. The XML document element name is “email”.
Enfocus Switch 10 Element name Data type Description Destination Text For FTP, the complete target URL for the job For Mail, the list of destination email addresses FlowElementName Text The name of the flow element that produced this log file (as displayed in the canvas) FlowElementType Text The type of the flow element that produced this log file (e.g.
Enfocus Switch 10 Element name Data type Description JobOrigin Text An indication of the origin of the processed job before it was injected in the flow; for example, a Submit point writes the absolute path of the original job (on the client machine) in this field JobPath Text The absolute file or folder path for the processed job as it resided in the input folder before being processed, including unique filename prefix JobPriority Integer The job priority assigned to the processed job as a signe
Enfocus Switch 10 The property editor for editable metadata fields allows creating an ordered list of field definitions (using the buttons under the listbox on the left-hand side). For each field definition, the property editor allows editing the properties described in the table below (using the edit fields and controls on the right-hand side). Property Description Label The label shown in front of the field.
Enfocus Switch 10 Property Description In case "Data type" is Dropdown list with dynamically generated content, this default value might not correspond with one of the list items. In this case the "Default value" is empty in SwitchClient. In case the "Data type" format and the default values format do not match, Switch tries to force the formatting of the data type property (example, Data type is hour and minute and the Default value is a text variable).
Enfocus Switch 10 fields are grayed-out, except the Show if parent equals ... property, the Read only property and the Display metadata field property. Behavior of updated fields in SwitchClient The metadata from the submit dataset is shown as the default value. SwitchClient users can read and change this data (if allowed). The new value is written to the check dataset. So technically, this is not a real update from the data but a copy from a field of one dataset (submit) to another (check).
Enfocus Switch 10 Property Description Label The label shown in front of the field Description A hint displayed when the cursor hovers over the field Data type The field’s data type: Boolean or string Calculated value A script expression that evaluates to the value of the metadata field; it is evaluated in the context of the job being viewed by the user so that it can use metadata associated with the job Client fields schema The Submit point and Checkpoint tools pickup metadata fields entered by
Enfocus Switch 10 Element name Description of element contents Element is present format A regular expression that matches the values allowed for the field (relevant only if data type is string) If type is string and if regexp is not blank required Equals "true" if the user is required to enter a If type is string non-blank value, "false" otherwise (relevant only if data type is string) value The value for the field: • For boolean data types: "true" or "false" • items Always For string data typ
Enfocus Switch 10 Location paths A location path is a sequence of one or more location steps separated by a slash. Each location step in turn (from left to right) selects a set of nodes relative to the context node determined by the previous step. The initial context node is determined by the location path's context (for the data model queries in Switch this is always the document's root node; in the XML module it is the node being queried).
Enfocus Switch 10 selects the parent of the context node ..
Enfocus Switch 10 evaluates to the number of field elements in the document, regardless of their position in the node tree count(/doc/chapter[5]/section) evaluates to the number of section elements in the fifth chapter element in the doc document element string-length(normalize-space(para)) evaluates to the number of characters in the text contents of the para element, after removing leading and trailing white space and replacing sequences of white space characters by a single space Namespaces The examples
Enfocus Switch 10 XMP location path syntax An XMP location path points to a specific node in an XMP node hierarchy (whether the node exists or not). An XMP location path is a series of one or more XMP location steps separated by a slash. Each location step address the next child element, depending on the structure of the document.
Enfocus Switch 10 Examples The following examples address properties in the XMP Dublin Core schema, which is usually associated with the "dc" prefix. Thus these examples assume that the "dc" prefix is mapped to the Dublin Core namespace URI (http://purl.org/dc/elements/1.1/). Examples: dc:format Addresses the top-level data format property. dc:creator/*[1] Addresses the first item in the list of document creators, which by convention is the primary author of the document.
Enfocus Switch 10 17. Developing scripts 17.1 Using SwitchScripter Finding your way around SwitchScripter To launch SwitchScripter: • • • Double-click the SwitchScripter application icon, or Double-click a Switch script package (a file with the ".sscript" filename extension), or Select a script element in the canvas and choose the "Edit script package" menu item in its context menu. SwitchScripter offers a workspace window to edit a single script package.
Enfocus Switch 10 Workspace area Description Toolbar Contains tool buttons for the most frequently used functions Declaration pane Allows editing the script declaration, defining support for connections, injected properties and so on Fixture pane Allows setting up an emulated test environment so that you can test-run a script without attaching it to a flow Properties pane Serves to edit the properties of the item currently selected in the declaration or fixture pane Program pane Allows editing y
Enfocus Switch 10 Tool Description Messages pane Show or hide the Messages pane Edit Tool Description Undo Undo the most recent text editing operation in the Program pane (supports multipleundo) Redo Redo the most recently undone text editing operation in the Program pane Copy Copy the selected text in the Program pane to the clipboard Paste Paste the clipboard's text contents in the Program pane Delete Delete the selected text from the Program pane Test Tool Description Select entry poin
Enfocus Switch 10 The Declaration pane allows viewing and editing the information in the script declaration for the script package. When you select an item in the Declaration pane, the Properties pane displays the properties for that item. See Writing a script on page 340 for background information. Terminology In this topic the term "property" is used to mean two different things: • A property injected into the flow element to which this script package will be attached, or into its outgoing connections.
Enfocus Switch 10 The information setup through the Fixture pane defines a simulated run-time environment for script testing purposes, including: • The values of the properties for the flow element to which the script is considered to be attached. • The number of incoming and outgoing connections and the relevant property values for each. • A list of input jobs (files or job folders), and the corresponding job ticket and metadata information for each.
Enfocus Switch 10 Property Description File or folder The absolute path to the file or folder for this input job Enabled Defines whether this input job is indeed included in the simulated test environment (can be used to temporarily exclude a job) Connection name The name of the incoming connection on which this job is to be presented Hierarchy info The hierarchy path to be stored in the internal job ticket (each segment as a separate string, ordered from top to bottom) Email addresses A list of
Enfocus Switch 10 Property Description Carry this type of files For traffic-light connections, determines whether this connection carries data files or log files Success out For traffic-light connections, determines whether a file moves along the connection depending on its success status Warning out Error out Injected connection properties Additional outgoing connection properties as specified in the Declaration pane SwitchScripter Program pane The Program pane offers a separate tab for each of t
Enfocus Switch 10 The Properties pane allows viewing and editing the properties for the currently selected item in the Declaration pane or in the Fixture pane. The properties for each item are described in the Declaration pane and Fixture pane topics. This pane is very similar to the Properties pane in the Switch designer. SwitchScripter Message pane The Messages pane displays a list of log messages generated by test runs of the script (see testing a script).
Enfocus Switch 10 6. Press the "Save" tool button to save your script package with an appropriate name in a location of your choice. 7. Verify the operation of your script as explained in "Testing a script", adjust the script and its declaration as desired and save the final result.
Enfocus Switch 10 Script expressions A script expression is a brief JavaScript program used to calculate the value of a flow element property. Users can enter a script expression in a property editor dialog within PowerSwitch, that is they do not need SwitchScripter. However, SwitchScripter provides some functions to help test more complex script expressions; see Testing a script expression on page 343.
Enfocus Switch 10 3. Click the "View declaration/fixture pane" tool button to reveal the Fixture pane. 4. In the Fixture pane, configure the basic fixture settings, the incoming jobs and the outgoing connections to reflect a relevant test scenario. If the script accesses information in the internal job ticket of incoming jobs, setup the corresponding test data as well. 5.
Enfocus Switch 10 3. In the Fixture pane, configure the basic fixture settings and at least one incoming job to reflect a relevant test scenario. If the script expression accesses information in the internal job ticket of its job, setup the corresponding test data as well. 4. Select the desired job in the Fixture pane (make sure it is enabled), select "script expression" in the entry point selector in the toolbar, and click the "Invoke entry point with the test fixture" tool button.
Enfocus Switch 10 Password Plug-in type Valid scripted plug-in password Third-party but not one of the built-in passwords Load action Loads the plug-in with the following changes: • • One of the built-in passwords Built-in Always puts it in the custom section If the plug-in requested a section other than custom or if its name clashes with a built-in tool or configurator, adds an underscore in front of its name Loads the plug-in in the requested section Creating a scripted plug-in Introduction A script
Enfocus Switch 10 The Switch installer places a number of built-in scripted plug-ins in the appropriate location. Accessing resources A scripted plug-in can obtain the absolute path to its plug-in folder through the getSpecialFolderPath("PluginResources") function offered by the Environment class. This allows a scripted plug-in to access resources contained in its plug-in folder (that is, next to the script package).
Enfocus Switch 10 The getApplicationLicensing entry point serves to provide feedback about the third-party application licensing state through a context menu on the scripted plug-in’s icon in the Elements pane. Testing special properties and entry points SwitchScripter does not emulate central management of these special properties and entry points.
Enfocus Switch 10 • Conversely a configurator may define the licenseApplication entry point without defining the “ApplicationLicense” property in case it does not need access to the license string outside of the licenseApplication entry point. Application discovery Ideally a third-party application can be configured and used from within Switch immediately after it is installed, without the need for separately launching the third-party application (for example, to license it).
Enfocus Switch 10 In this option the user enters a license key in a Switch dialog box that is accessed through a context menu item on the configurator’s icon in the Elements pane. Switch can pass the license key on to the third-party application at the time the user enters the license key (the most frequently used option) and/or each time an action is executed. The third-party application should document the licensing process for the configurator.
Enfocus Switch 10 Storage model Reference in Switch In a private repository (database) controlled by Name the third-party application and only accessible by Switch by name and through the third-party application Stored in exported flow Name Some applications support multiple storage models for the same property (that is, the property can be specified as a named repository item or as a file path). Switch configurators can easily accommodate this by providing multiple property editors for the property.
Enfocus Switch 10 Error handling The third-party application should clearly document how Switch can discriminate between: • Successful execution versus failure to execute an action. • Messages that should be passed on to the Switch execution log versus messages that are irrelevant to the Switch user (or output that can safely be ignored). • The “level” of messages passed on to the Switch execution log: info/warning/error.
Enfocus Switch 10 A Switch configurator can NOT control an application that requires a different folder watched for each configuration setup. Preferably the third-party application and Switch should be able to settle on a watched folder path without requiring user setup in the third-party application. The best way to achieve this is to provide a mechanism that allows Switch to set the watched folder path at its discretion.
Enfocus Switch 10 If this is not feasible, at the very least the encoding used must be well-defined and documented, and it should follow these guidelines: • Text that may contain a filename/path must be able to represent any Unicode code point. In essence UTF-8 or UTF-16 are the only options. • Text that may contain code points outside 7-bit ASCII (for example, localized messages for human readers) must be in a well-defined encoding that is able to represent the characters in the languages used.
Enfocus Switch 10 Property Description Include JavaScript If set to yes, the script package includes a JavaScript program and the corresponding tab in the program pane is enabled Include VBScript If set to yes, the script package includes a VBScript program and the corresponding tab in the program pane is enabled Include AppleScript If set to yes, the script package includes an AppleScript program and the corresponding tab in the program pane is enabled Incoming connections If set to yes, the scri
Enfocus Switch 10 Property Description Execution group The name of the execution group in which instances of this script reside; the precise interpretation depends on the selected execution mode: • Serialized: determines the scope of serialization • Concurrent: not used • Persistent: unambiguously identifies the script implementation Enable performance tuning If set to yes, additional performance tuning is enabled for the script package.
Enfocus Switch 10 Script expressions Script expressions may be evaluated in parallel with each other and with other scripts. Script expressions should not have side effects (other than issuing log messages) so this parallelism should not cause any problems.
Enfocus Switch 10 serialized mode execution is serialized but consecutive invocations may happen in different threads). • The contents of the predefined global script variable “persistent” is preserved across all invocations of entry points, whether from the same script instance or not (this persistence is the reason why all invocations must happen in the same thread).
Enfocus Switch 10 Execution mode Instances in same group are serialized Information can be Example usage preserved across invocations Serialized Yes No Control a command-line application that is launched and terminated within each invocation of jobArrived Persistent Yes Yes Control a command-line application that needs to be kept alive between invocations of jobArrived Property definition properties The following table describes the properties for each property definition contained in the script
Enfocus Switch 10 Property Description Validation The validation method for the value of this property, which is one of: • None: perform no validation for this property • Standard: perform standard validation for this property depending on the property editor used to enter the value • Custom: invoke the script’s isPropertyValid entry point to validate this property; do not perform standard validation • Standard and custom: first perform standard validation for this property, and if successful then
Enfocus Switch 10 Other property editors The “Editor 2/3/4/5” properties of a property definition offers the choices listed in the following table. Most of these property editors are modal dialogs. See working with properties for information on using property editors.
Enfocus Switch 10 Property editor Resulting value External editor The file path to a property set edited by a third-party application; see external property editor Extra properties for certain property editors The following extra properties are shown just after the “Editor” properties only when a particular property editor is chosen.
Enfocus Switch 10 it is not strictly true for all data types; for example a file path becomes invalid when the target file is removed. Properties that contain a variable or a script expression are validated while the flow is running, since their value cannot be determined at design time. Just before each invocation of the jobArrived entry point, Switch performs run-time validation for all properties of the flow element that contain a variable or a script expression.
Enfocus Switch 10 Property editor Design-time validation requires that the value… Single-line text with variables N/A (if the value contains no variables: Is non-empty) Multi-line text with variables N/A (if the value contains no variables: Is non-empty) Condition with variables N/A File patterns Has at least one item and each item has valid filename pattern syntax Folder patterns Has at least one item and each item has valid filename pattern syntax File types Has at least one item and each it
Enfocus Switch 10 Property editor Run-time validation scheme Literal Same as design-time scheme Choose file Same as design-time scheme Choose folder Same as design-time scheme Regular expression Same as design-time scheme, or a Boolean value (*) File type Same as design-time scheme Select from library Same as design-time scheme Multi-line text -- Script expression -- Single-line text with variables -Multi-line text with variables -Condition with variables -- File patterns Same as desig
Enfocus Switch 10 For the first two editors, validation is always performed at design time. For the last two editors, validation is performed at run time (except if the single-line text does not contain any variables). In all cases, the property value is guaranteed to contain one of the following: • A valid file path that points to an existing file. • One of the library items returned for the property by the getLibraryForProperty entry point.
Enfocus Switch 10 Property Description Arguments for edit The argument string passed to the application when there is a pre-existing property set to be edited, after substituting all occurrences of %1 and %2 as described below Substitutions in argument strings The following substitutions are performed in the specified argument strings: Placeholder Replaced by %1 The file path for the property set: • If it points to an existing file, the external application should load this file and replace it by th
Enfocus Switch 10 18. Scripting reference 18.1 Scripting API - Introduction 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.
Enfocus Switch 10 Module Description Availability Flow element module Accessing script flow element properties, including incoming and outgoing connections All scripting languages 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 Metadata module Retrieving the contents of metadata fields from a All
Enfocus Switch 10 Identifiers, variables and constants JavaScript identifiers match the regexp pattern [_A-Za-z][_A-Za-z0-9]*. Identifiers are used for variables, constants, class names, function names and labels. JavaScript reserves some words which are valid identifiers for its own use. See declarations for the complete list.
Enfocus Switch 10 function y() { return m_y; } function r() { return m_r; } } class ColorCircle extends Circle { var m_rgb; function ColorCircle( posx, posy, radius, rgbcolor) { Circle( posx, posy, radius ); m_rgb = rgbcolor; } function setRgb( rgbcolor ) { m_rgb = rgbcolor; } function rgb() { return m_rgb; } } A class's constructor is the function which has the same (case-sensitive) name as the class itself.
Enfocus Switch 10 with the object they are assigned to, so even though the object (obj in the above example) gets the property myProperty, it does not mean that other objects of type Object will have the property "myProperty", unless explicitly stated. Comments JavaScript supports the same commenting syntax as C++. One-line comments may appear on a line of their own or after the statements on a line. Multi-line comments may appear anywhere. // A one-line comment. /* A multi-line comment.
Enfocus Switch 10 Example: var m2 = mammals[2]; mammals[2] = "gorilla"; var thing = things[2][1] The first statement retrieves the value of the third item of the mammals array and assigns it to m2, which now contains "monkey". The second statement replaces the third item of the mammals array with the value "gorilla". The third statement retrieves the second item of the third item's array from the things array and assigns it to thing, which now contains "shrub".
Enfocus Switch 10 reverse( ) Reverses the items in the array. var x = new Array( "a", "b", "c", "d" ); x.reverse(); // x == [ "d", "c", "b", "a" ] shift( ) : Object Shifts (that is, removes) the bottom-most (left-most) item off the array and returns it. var x = new Array( "a", "b", "c" ); var y = x.
Enfocus Switch 10 the number of items to delete) and there must be no new items given. var x = new Array( "a", "b", "c", "d" ); // 2nd argument 0, plus new items ==> insertion x.splice( 1, 0, "X", "Y" ); // x == [ "a", "X", "Y", "b", "c", "d" ] // 2nd argument > 0, and no items ==> deletion x.splice( 2, 1 ); // x == [ "a", "X", "b", "c", "d" ] // 2nd argument > 0, plus new items ==> replacement x.
Enfocus Switch 10 // time flies.. var date2 = new Date(); var timedifference = date2.getTime() - date1.getTime(); Static Date Function parse( dateString : String ) : Number This is a static function that parses a string, dateString, which represents a particular date and time. It returns the number of milliseconds since midnight on the 1st January 1970. The string must be in the ISO 8601 extended format: YYYY-MM-DD or with time YYYY-MM-DDTHH:MM:SS. var d = new Date( Date.
Enfocus Switch 10 getYear( ) : Number Returns the year using local time. var d = new Date( 1975, 12, 25 ); var x = d.getYear(); // x == 1975 getHours( ) : Number Returns the hours using local time. The value is always in the range 0..23 var d = new Date( 1975, 12, 25, 22 ); var x = d.getHours(); // x == 22 getMilliseconds( ) : Number Returns the milliseconds component of the date using local time. The value is always in the range 0..999.
Enfocus Switch 10 getTime( ) : Number Returns the number of milliseconds since midnight on the 1st January 1970 using local time. var d = new Date( 1975, 12, 25, 22, 30 ); var x = d.getTime(); // x == 1.91457e+11 setDate( dayOfTheMonth Sets the day of the month to the specified dayOfTheMonth in local : Number) time. var d = new Date( 1975, 12, 25, 22, 30 ); d.setDate( 30 ); // d == 1975-12-30T22:30:00 setYear( year : Number) Sets the year to the specified year in local time.
Enfocus Switch 10 setSeconds( seconds : Sets the seconds to the specified seconds, which must be in the Number, optMilliseconds range 0..59, in local time. The milliseconds past the seconds : Number ) (optMilliseconds) can also be specified. var d = new Date( 1975, 12, 25, 22, 30 ); d.setSeconds( 25 ); // d == 1980-12-30T22:30:25 setTime( milliseconds : Number ) Sets the date and time to the local date and time given in terms of milliseconds since midnight on the 1st January 1970.
Enfocus Switch 10 Number Construction Numbers are not normally constructed, but instead created by simple assignment, example: var x = 3.142; Number Properties MAX_VALUE : Number The maximum value for floating point values. MIN_VALUE : Number The minimum value for floating point values. Number Functions toString( ) : String Returns the number as a string value. Object Object is the base type for all JavaScript objects. Object provides a toString() function which is usually overridden by subclasses.
Enfocus Switch 10 height : Number The height of the rectangle. top : Number The position of the top of the rectangle. This is defined as top = y. bottom : Number The position of the bottom of the rectangle. This is defined as bottom = y + height + 1. left : Number The position of the rectangle's left side. This is defined as left = x right : Number The position of the rectangle's right side. This is defined as right = x + width + 1. center : Point The center of the rectangle.
Enfocus Switch 10 moveLeft( pos : Number ) Moves the rectangle so that its left property is equal to pos. moveRight( pos : Number ) Moves the rectangle so that its right property is equal to pos. moveTop( pos : Number ) Moves the rectangle so that its top property is equal to pos. moveBottom( pos : Number ) Moves the rectangle so that its bottom property is equal to pos. moveBy( dx : Number, dy : Number Translates the rectangle by dx and dy. dx and dy will be ) added to x and y.
Enfocus Switch 10 A regular expression can be set to global either by setting the global property on a regexp object or by specifying a trailing g in the pattern. var re = /mypattern/g; var re = /mypattern/; re.global = true ignoreCase : Boolean // Global by method #1 // Global by method #2 Specifies that the regexp ignores case when matching. Case-insensitivity can is enabled by either specifying a trailing i after the pattern or by setting the ignoreCase property.
Enfocus Switch 10 re.pos(1); // returns 6, position of "John Doe" re.pos(2); // returns -1, no more captures Size A Size object represents a two-dimensional size, using width and height. Size Construction The Size class provides three constructors: var size = new Size( 100, 200 ); // width = 100, height = 200 var duplicate = new Size( size ); // width = 100, height = 200 var empty = new Size(); // width = 0, height = 0 Size Properties width : Number The width of the size.
Enfocus Switch 10 String Functions charAt( pos : Number ) : String Returns the character in the string at position pos. If the position is out of bounds, undefined is returned. charCodeAt( pos : Number ) : Number Returns the character code of the character at position pos in the string. If the position is out of bounds, undefined is returned. indexOf( pattern : String or RegExp, Returns the index of pattern in the string, starting at pos : Number ) : Number position pos.
Enfocus Switch 10 isEmpty() : Boolean Returns true if the string is empty, that is, has a length of 0; otherwise returns false. left( length : Number ) : String Returns a substring containing the length leftmost characters of this string. right( length : Number ) : String Returns a substring containing the length rightmost characters of this string.
Enfocus Switch 10 • f - format as [-]9.9 • g - use e or f format, whichever is the most concise • G - use E or f format, whichever is the most concise With 'e', 'E', and 'f', precision is the number of digits after the decimal point. With 'g' and 'G', precision is the maximum number of significant digits (trailing zeroes are omitted). Math The Math object, which always exists in a JavaScript program, supports many common mathematical functions. with ( Math ) { var x = PI * 2; var angle = 1.
Enfocus Switch 10 acos( number : Number ) : Number Returns the arccosine of the given number in radians between 0 and Math.PI. If the number is out of range, returns NaN. asin( number : Number ) : Number Returns the arcsine of the given number in radians between -Math.PI/2 and Math.PI/2. If the number is out of range, returns NaN. atan( number : Number ) : Number Returns the arctangent of the given number in radians between -Math.PI/2 and Math.PI/2. If the number is out of range, returns NaN.
Enfocus Switch 10 random() : Number Returns a pseudo-random floating point number between 0 and 1. Pseudo random numbers are not truly random but may be adequate for some applications such as simple simulations. round( number : Number ) : Number Returns the number rounded to the nearest integer. If the fractional part of the number is >= 0.5, the number is rounded up; otherwise it is rounded down. sin( number : Number ) : Number Returns the sine of the given number in radians.
Enfocus Switch 10 Built-in variables arguments : Array This is an array of the arguments that were passed to the function. It only exists within the context of a function. function sum() { total = 0; for ( i = 0; i < arguments.length; i++ ) { total += arguments[ i ]; } return total; } Built-in functions eval( string : String ) This function parses and executes the contents of the string, taking the text to be valid JavaScript.
Enfocus Switch 10 var h = parseInt( "0xFF" ); // h == 255 var x = parseInt( " 459xyz " ); // x == 459 Built-in operators Javascript offers built-in operators in the following categories: • Assignment operators • Arithmetic operators • String operators • Logical operators • Comparison operators • Bit-wise operators • Special operators Assignment operators These operators are used to assign the value of expressions to variables.
Enfocus Switch 10 = operator var variable = expression; The assignment operator is used to assign the value of an expression to the variable. It is an error to attempt to assign to a constant. += operator variable += expression; This operator adds the value of the expression to the variable. It is the same as: variable = variable + expression; but is shorter to write and less error-prone. See also += string operator.
Enfocus Switch 10 and the value of the variable and assigns the result to the variable. <<= operator variable <<= expression; This operator performs a bit-wise left shift on the variable by an expression number of bits. Zeros are shifted in from the right. >>= operator variable >>= expression; This operator performs a bit-wise (sign-preserving) right shift on the variable by an expression number of bits.
Enfocus Switch 10 + operator operand1 + operand2 This operator returns the result of adding the two operands (operand1 and operand2). See also + string operator. ++ operator ++operand; // pre-increment operand++; // post-increment The pre-increment version of this operator increments the operand and returns the value of the (now incremented) operand. The post-incremented version of this operator returns the value of the operand and then increments the operand.
Enfocus Switch 10 These operators provide string functions using operators. Many other string functions are available, see String. + string operator str1 + str2 This operator returns a string that is the concatenation of its operands, (str1 and str2). See also + arithmetic operator. += string operator str1 += str2 This operator appends its second operand (str2) onto the end of the first operand (str1). See also += assignment operator.
Enfocus Switch 10 == operator operand1 == operand2 Returns true if the operands are equal; otherwise returns false. != operator operand1 != operand2 Returns true if the operands are not equal; otherwise returns false. === operator operand1 === operand2 Returns true if the operands are equal and of the same type; otherwise returns false. !== operator operand1 !== operand2 Returns true if the operands are not equal or if the operands are of different types;otherwise returns false.
Enfocus Switch 10 operand2). | operator operand1 | operand2 Returns the result of a bit-wise OR on the operands (operand1 and operand2). ~ operator ~ operand Returns the bit-wise NOT of the operand. << operator operand1 << operand2 Returns the result of a bit-wise left shift of operand1 by the number of bits specified by operand2. Zeros are shifted in from the right.
Enfocus Switch 10 The JavaScript function operator supports closures, for example: function make_counter( initialValue ) { var current = initialValue; return function( increment ) { current += increment; return current; } } // ... var counterA = make_counter( 3 ); // Start at 3. var counterB = make_counter( 12 ); // Start at 12.
Enfocus Switch 10 function min() { return this._min; } function setMax( value ) { this._max = value; } function setMin( value ) { this._min = value; } } typeof operator typeof item This operator returns a type of the object as a string. Example: var f = new Function("arguments[0]*2"); // "object" var str = "text"; // "string" var pi = Math.PI; // "number" Functions and built-in objects have a "typeof" of "function".
Enfocus Switch 10 Example: class Area { static var count = 0; var _name; function Area( name ) { this._name = name; this.count++ } function destroy() { this.count--; } static function count() { return this.count; } function name() { return this._name; } function setName( name ) { this._name = name; } } In this example we define the "Area" class.
Enfocus Switch 10 var var variableName; var anotherVariableName = InitialValue; This keyword is used to declare and optionally initialize variables. If just the variableName is given, the variable is created, but it has no value, that is, its value is undefined. If an InitialValue is given, the variable is created and assigned this InitialValue. Variables declared within functions are local to the function in which they are declared. Variables declared outside of functions and classes are global.
Enfocus Switch 10 break red; } } } case switch ( expression ) { case Value: Statements; break; default: DefaultStatements; break; } This keyword is used in Switch statements. For each possible value that a Switch statement's expression may evaluate to, one case may be written, (but see default.) If a case's literal value (Value) matches the value of the Switch statement's expression, then that case's statements (Statements) are executed.
Enfocus Switch 10 continue for ( var i = 0; i < limit; i++ ) { if ( condition ) { continue; } Statements; } This keyword is used within the context of a for, while or do loop. If a continue statement is encountered in a for loop, execution immediately passes to the third part of the for loop (normally where a counter is incremented or decremented), and then execution continues normally, that is, the middle part of the for loop (the conditional) is tested and if true, the body of the loop is executed.
Enfocus Switch 10 x += 5; if ( x == 50 ) continue; debug( x ); } while ( x < 100 ); The example outputs 5, 10, 15, ..., 45, 55, 60, 65, ..., 95. See also continue and break. else if ( condition ) { Statements; } else { ElseStatements; } The else keyword is used in conjunction with if. See if for details. for for ( i = 0; i < limit; i++ ) { Statements; } This keyword is used to create a loop that executes a fixed number of times.
Enfocus Switch 10 if if ( expression1 ) { // statements1 } else { // elsestatements } if ( expression1 ) { // statements1 } else if ( expression2 ) { // statements2 } // else if ... } else { // elsestatementsN } An if statement provides a two-way branch. A multi-way branch is achieved using else ifs. (See also Switch.
Enfocus Switch 10 If the return statement is followed by an expression (optExpression) the value of the expression is returned to the caller. Example: function inRange( v, min, max ) { if ( v >= min && v <= max ) { return true; } else { return false; } } switch switch( expression ) { case Value : Statements; break; default : DefaultStatements; break; } A switch statement provides a multi-way branch.
Enfocus Switch 10 a break statement and execution "falls through" to case 4. If expr is not 1, "two", 3 or 4 then the default case will be matched and doDefaultAction() will be executed. throw try { Statements; throw "an exception"; } catch ( e ) { if ( e == "an exception" ) { ExceptionStatements; } else { OtherExceptionStatements } } The throw keyword is used to raise user-defined exceptions.
Enfocus Switch 10 Catch blocks come in two varieties, unqualified and qualified. An unqualified catch block has the form: catch ( e ) { /* statements */ } and a qualified catch block has the form: catch ( e if e instanceOf RangeError ) { /* statements */ } See catch for details of the qualifiers. try...finally If an exception occurs within a try...finally block, control is passed to the finally block. This is useful if you want to ensure that something happens at the end of the block, no matter what.
Enfocus Switch 10 Example: var i = 10; while ( i > 0 ) { debug( i ); i--; } See also continue and break. with with ( QualifyingName ) { Statements; } This keyword is used to indicate that any unqualified names in the Statements should be qualified by QualifyingName. Example: // Without with debug( Math.abs( -4 ) ); debug( Math.pow( 2, 3 ) ); debug( Math.
Enfocus Switch 10 Codec A codec (short-hand for "code-decode") specifies the text encoding used to represent a Unicode string as a sequence of 8-bit bytes. Various codecs are in use throughout the industry. The utility module refers to supported codecs through predefined names.
Enfocus Switch 10 When the codec is set to UTF-8, the utility module does not output a BOM. This is the standard behavior expected by most applications. When the codec is set to UTF-8BOM, the utility module outputs a 3-byte UTF-8 BOM at the beginning of the data (this is just a marker to indicate UTF-8 since there are no byte-order issues in this encoding). Be careful when using this codec, because many applications are not able to correctly interpret a UTF-8 BOM.
Enfocus Switch 10 ByteArray ( source : String, codec : String ) : ByteArray Constructs a new byte array by converting a source string with the specified codec; see text encoding. Properties length : Number The number of bytes in the byte array. This value is read-only. size : Number Member functions getAt( index : Number ) : Number Returns the value of the byte at the specified zero-based index in the byte array. The returned value is an integer in the range [0..255].
Enfocus Switch 10 If the privateKeyPath argument is missing or null, the private key built into Switch is used instead. The resulting signature allows a receiver to verify that the data was indeed generated by a script running in Switch (since the public key corresponding to the private key is part of the public Switch documentation).
Enfocus Switch 10 Access mode Description File.WriteOnly Opens the file in write-only mode; if this flag is used with Append, the file is not truncated; but if used on its own (or with Truncate), the file is truncated File.ReadWrite Opens the file in read/write mode; the file is not truncated File.
Enfocus Switch 10 hasArrived( fileName : Returns true if it can be assumed that the file has arrived according String, stabilitySeconds to the heuristic describe above; otherwise returns false. The stability : Number ) : Boolean period is specified in seconds (as a floating point number).
Enfocus Switch 10 Model Description Implementation immediately and leave the follow-up to the timerFired entry point Static Text I/O functions read( fileName : String, codec : Reads and returns the contents of the file fileName if possible; String ) : String otherwise throws an exception. The optional argument codec specifies the text encoding used to read the file; see text encoding.
Enfocus Switch 10 fullName : String The fullName of the file, including path, name, and extension. baseName : String The name of the file, excluding its path and extension. extension : String The file name's extension. symLink : String The expansion of the symlink if the file is a symlink; otherwise empty. exists : Boolean True if the file exists; otherwise false. readable : Boolean True if the file is readable; otherwise false. writable : Boolean True if the file is writable; otherwise false.
Enfocus Switch 10 remove() Deletes the file if possible; otherwise throws an exception. Member Text I/O functions readChar() : Number Reads one character from the file if possible; otherwise throws an exception. The character is represented as a 16-bit Unicode code point. read() : String Returns the entire content of the file as a string if it can be read; otherwise throws an exception. readLine() : String Reads one line from file if possible; otherwise throws an exception.
Enfocus Switch 10 FilterSpec Description Dir.Dirs List directories only Dir.Files List files only Dir.Drives List disk drives only Dir.NoSymLinks Do not list symbolic links Dir.All List directories, files, drives and symlinks (this does not list broken symlinks unless you specify System) Dir.TypeMask A mask for the the Dirs, Files, Drives and NoSymLinks flags Dir.Readable List files for which the application has read access Dir.
Enfocus Switch 10 SortSpec Description Dir.IgnoreCase Sort case-insensitively Static properties current : String The current directory. home : String The home directory. root : String The root directory. drives : String[ ] An Array of strings containing the drive names (c:, d:, etc). Static functions The Utility module uses "/" as a directory separator throughout (although it understands the conventions of the platform it is used on).
Enfocus Switch 10 A hasArrived() function often returns only after a delay of at least the stability period. However if it can be determined right away that the file has not yet arrived, the function returns immediately. Thus it is never acceptable to invoke a hasArrived() function in a tight loop. The following table describes the two most important use cases for dealing with an external application through the hasArrived() functions.
Enfocus Switch 10 canonicalPath : String Contains the canonical path, i.e. a path without symbolic links or redundant "." or ".." elements. readable : Boolean True if the directory is readable; otherwise false. exists : Boolean True if the directory exists; otherwise false. Member functions filePath( fileName : String ) : String Returns the path name of the file fileName in the directory. absFilePath( fileName : String ) Returns the absolute path name of the file fileName in the : String directory.
Enfocus Switch 10 rmdir( dirName : String ) Deletes the directory dirName if possible; otherwise throws an exception. rmdir() Deletes this directory if possible; otherwise throws an exception. rmdirs( dirName : String ) Deletes the directory structure dirName if possible; otherwise throws an exception. rmdirs() Deletes this directory structure if possible; otherwise throws an exception. fileExists( fileName : String ) : Boolean Returns true if the file fileName exists; otherwise returns false.
Enfocus Switch 10 Static functions execute( command : String, stdin : String ) : int Executes command synchronously and passes stdin to its standard input if specified. When the program ends its output is accessible through Process.stdout and Process.stderr. command can contain both the program and command line arguments, separated by spaces. The function returns the executed command's return code on exit.
Enfocus Switch 10 exitStatus : Number Contains the exitStatus of the program when it has finished. This property is read-only. Member functions start( env : String[ ] ) Tries to run a process for the command and arguments that were specified with the argument property or that were specified in the constructor. The command is searched for in the path for executable programs; you can also use an absolute path in the command itself.
Enfocus Switch 10 writeToStdin( buffer : String ) Writes the data buffer to the standard input stream of this process. The process may or may not read this data. closeStdin() Closes the standard input stream of the process. tryTerminate() Asks the process to terminate. Processes can ignore this if they wish. If you want to be certain that the process really terminates, you can use kill() instead. kill() Terminates the process.
Enfocus Switch 10 18.4 XML module Node class Node is the abstract base class for the Document, Element, Text, and Comment classes. A Node object represents a node in the XML tree of one of those types. Accessing node properties getNodeType() : String Returns the node type (“Document”, “Element”, “Text”, “Comment” or “Attr”). getOwnerDocument() : Document Returns the document object in which this node resides.
Enfocus Switch 10 evalToNumber( xpath : String, prefix-map : Map ) : Number Evaluates an XPath 1.0 expression in the node’s context and converts the result to a numeric value with the XPath 1.0 number() function. evalToBoolean( xpath : String, prefix-map : Map ) : Boolean Evaluates an XPath 1.0 expression in the node’s context and converts the result to a Boolean value with the XPath 1.0 boolean() function.
Enfocus Switch 10 Child nodes A Document can directly contain any number of Comment nodes (including the XML declaration, which if present is always the first node of the document) and a single Element node (which is called the document element). A Document can not contain any Text nodes and it can not contain two or more Element nodes. The functions described in this section log an error if these restrictions are violated.
Enfocus Switch 10 Creating new objects createEmptyMap( ) : Map Returns a new empty prefix map object. createDefaultMap( ) : Map Returns a new prefix map object that already contains all mappings that occur in the document. createElement( qualified-name : String, prefix-map : Map ) : Element Returns a newly created element node with the specified name, owned by this document. If the element name is qualified its namespace prefix must occur in the map provided in the second argument.
Enfocus Switch 10 getChildNodes( ) : NodeList Returns the list of child nodes of this element, in document order or an empty list if the element has no child nodes. getFirstChild( ) : Node Returns the first child node of this element or null if there is none. getLastChild( ) : Node Returns the last child node of this element or null if there is none. appendChild( new-child : Node ) Appends a new child node to the list of children for this element.
Enfocus Switch 10 Text content getValue( ) : String Returns the text content of this node. Comment class A Comment object represents an XML comment node. Comment inherits from the Node class, so all functions defined for Node can be used with Comment. Comment content getValue( ) : String Returns the content of the comment represented by this node, that is, all the characters that appear between the ''. Attr class An Attr object represents an attribute of an XML element.
Enfocus Switch 10 getItem( index : Number ) : Node or Returns the item in the list at the specified (zero-based) Attr index. If the index is out of range, the function returns null. length : Number This is a read-only property (rather than a function) that contains the value returned by getCount(). at( index : Number ) : Node or Attr Returns the same value as getItem(index). 18.
Enfocus Switch 10 Static Functions request( url : String, Initiates a remote procedure call (RPC) or sends an XML request-object : request-object, message to a SOAP HTTP endpoint, waits for the endpoint to action : String ) : response-object reply (synchronous processing) and returns its response. An exception is thrown if the request object does not conform, when the SOAP endpoint returns a SOAPFault or when there is a failure from the underlying HTTP transport layer.
Enfocus Switch 10 An exception is thrown if the request object does not conform, when the SOAP endpoint returns a SOAPFault or when there is a failure from the underlying HTTP transport layer. sendMessage ( url : String, action : String ) Initiates a remote procedure call (RPC) or sends an XML message to a SOAP HTTP endpoint without waiting for a reply. An exception is thrown if the request object does not conform or when there is a failure from the underlying HTTP transport layer.
Enfocus Switch 10 saveAttachment(index : Number, file-path : String) : Boolean save attachment to the disk file saveAttachment(id : String, file-path : String) : Boolean setAttachmentSendType(attachment-type : Number) set/get attachment send type: 0 - DIME format; 1 - MIME format getAttachmentSendType() : Number Working with SOAP message body, retrieving information Since SOAP message body is a text in XML format, it is convenient to gather information from it as from XML.
Enfocus Switch 10 Parameter Description passwordtype One of “PasswordText” or “PasswordDigest”. Qualified names In the request object, a qualified name is specified as a string in the : notation, where can be a custom namespace or one of the predefined prefixes “xsd” (http://www.w3.org/2001/XMLSchema) or “SOAP-ENC” (http://schemas.xmlsoap.org/soap/encoding/). For example: "http://soapinterop.
Enfocus Switch 10 Property Description soapType : String The SOAP type (as a qualified type name) that will be used for the value when generating the SOAP message; this is useful when a datatype is needed other than the automatic bindings described above soapValue : String The value that will be used when generating the SOAP message The value is passed unescaped (example: “<” is not converted to “<”) which means that it can be a raw XML fragment that will be passed on as is For example, integers a
Enfocus Switch 10 SOAP type JavaScript type xsd:dateTime Date SOAP-ENC:Array Array Comments Single-dimension arrays only All items must have the same data type, which must be boolean, integer, float, string or dateTime xsd:hexBinary ByteArray Uses the ByteArray “Hex” codec xsd:base64Binary ByteArray Uses the ByteArray “Base64” codec SOAP-ENC:base64 ByteArray Uses the ByteArray “Base64” codec Other String Copies the XML string content without change Example var url =
Enfocus Switch 10 • data-codec: affects STRING and BINARY data fields when retrieved as a string. The codecs established with the connect() function are used for all Statement instances derived from the DataSource during the connection. However the Statement.getString() function allows overriding the data-codec on an individual field basis.
Enfocus Switch 10 Item Algorithm to determine codec specifies a data-codec other than UTF-16, use that codec. Otherwise use latin-1 DataSource class Background ODBC (Open Database Connectivity) provides a standard mechanism for using databases independent of programming languages, database systems, and operating systems. The ODBC specification offers a procedural API for using SQL queries to access data.
Enfocus Switch 10 A disconnected data source can be reconnected by calling connect(). Switch automatically disconnects a data source when exiting the entry point in which it was constructed .Still, it is good programming style to explicitly disconnect all data sources. isConnected( ) : Boolean Returns true if the data source is currently connected, false otherwise. Statement class The Statement class provides a context to execute a series of SQL statements on a data source and retrieve the results.
Enfocus Switch 10 Executing SQL statements execute( sql : String ) : Boolean Executes the specified SQL statement on the associated data source, and stores the results. Returns the value of isOK() after performing the operation. tables ( table-type : String ) : String Returns a list of table names. The list includes all tables of the specified type in the data source. The table type must be specified in all upper-case, and multiple types must be comma-separated (for example: “TABLE, VIEW”).
Enfocus Switch 10 • BINARY: character string in unknown encoding, or binary data, or unsupported data type getColumnSize (column : Returns the size in bytes needed to store the data in the specified Number or String ) : Number column (one-based index or column name), or -1 if the size can’t be determined. Getting the actual data in the result set isRowAvailable( ) : Boolean Returns true if a row is available for fetching; false otherwise.
Enfocus Switch 10 Supported conversions Column data type Number INTEGER Date String Binary Straightforward (*) Not supported Decimal representation of the number Not supported REAL Straightforward (*) Not supported Decimal representation of the number Not supported DATETIME Not supported Straightforward ISO 8601 representation of the date-time Not supported STRING Decimal number representation (Unicode) Interpret as ISO date-time representation (Unicode) Straightforward (Unicode) Not
Enfocus Switch 10 jobArrived( s : Switch, job This entry point is invoked each time a new job arrives in one of the : Job ) input folders for the script element. The newly arrived job is passed to the entry point as the second argument. timerFired( s : Switch ) This entry point is invoked for the first time immediately after the flow is activated and thereafter it is invoked at regular intervals regardless of whether a new job arrived or not.
Enfocus Switch 10 Returns true if the value of the specified property is deemed valid, false otherwise. If this entry point is absent, it is considered to return false.
Enfocus Switch 10 plug-in these entry points are never invoked. See also creating a scripted plug-in, configurator guidelines and detecting third-party applications. findApplicationPath( e Is invoked for a scripted plug-in to discover the associated third-party : Environment, startup application – if any. : Boolean ) : String Returns the absolute file path for the third-party application’s executable (“.exe” on Windows, “.app” on Mac).
Enfocus Switch 10 The entry point returns true if initialization was successful and false if it is not able to initialize appropriately. In the latter case Switch marks all script instances of this type as a problem process and it retries initialization at regular intervals. As long as initialization fails, Switch refrains from invoking jobArrived and timerFired for the script. If the entry point is absent, this means the script does not need initialization and the entry point is assumed to return true.
Enfocus Switch 10 between the regular functions and the cleanup function is possible through the global data access functions of the Environment class, but this is restricted to plain strings (rather than arbitrary objects). After aborting a thread as described, Switch restarts the regular invocation sequence in a new thread whenever it receives a new processing request.
Enfocus Switch 10 Numeric type Display type Description 6 End A formal message that marks the completion of a task for which a start message was previously issued -1 Debug An informational message solely intended for debugging purposes -2 Assert A message solely intended for debugging purposes that is issued only when a coding error is discovered Log Message The message argument and the optional extra argument specify the message being issued, as a constant and variable part. For example: e.
Enfocus Switch 10 Maintaining global data The data accessed by these functions is stored in a global repository that is part of the persistent state of the flow execution engine. Access to the repository is serialized (to avoid conflicts caused by access in multiple threads) and the contents of the repository persist across invocations of the flow engine.
Enfocus Switch 10 unlockGlobalData( ) Releases the current global data lock, if any. Does nothing if there is no current lock. Switch automatically releases the current lock, if any, after a script returns from the entry point. This is only a safeguard: a script should explicitly release a lock as soon as it is no longer needed.
Enfocus Switch 10 multiple licenses are activated, the license with the longest license time period is used. getLanguage( ) : String Returns the name of the currently active language preference, in English. For example, the currently implemented languages are “English” and “German”. getLanguageEnvironment( ) Returns the name of the currently active language environment : String preference, in English. For example, the currently implemented language environments are “Western” and “Japanese”.
Enfocus Switch 10 Mac OS X automatically adds an entry to its application database when an application bundle is installed or copied to the system. Thus on Mac OS X the function queries the system application database with the specified key, which must be the filename of the application bundle (that is, the same name one would use to address the application from AppleScript) or the application’s bundle identifier as provided in the property list located inside the application bundle (example: “com.adobe.
Enfocus Switch 10 folderID Returns an absolute path to The resource folder is intended for use by scripted plug-ins (see creating a scripted plug-in) and should not be used from regular script packages except for testing; there is no reliable way to transport external resources with regular script packages SciptData The folder that serves as a common repository for custom “global” Switch script data; it is shared by all scripts (and all users) so callers must provide unique names for any files stored in
Enfocus Switch 10 This function does not differentiate between prerelease and release builds. This function was introduced in Switch 08 update 6. If a script may be hosted by an older version of Switch, the script should check for the presence of this function before using it. For example: if ("getServerVersion" in s && s.getServerVersion() >= 8.07) ...
Enfocus Switch 10 provides a list of passwords for opening password-protected archives. Returns true if successful, false if not (in which case an appropriate error message is logged). This function behaves exactly as the uncompress tool (except that it doesn’t add a unique name prefix to the output file or folder’s name). That is, it supports the same formats and the output file/folder is structured in the same way.
Enfocus Switch 10 Client connection getClientConnection( Returns the valid ClientConnection object if the script code is executed in ) : ClientConnection the context of a client connection, otherwise null is returned. Note: The ClientConnection object is available only in context of a client connection. If there is a client connection which triggered evaluation of a script, then this script returns a valid ClientConnection object after calling this method.
Enfocus Switch 10 getInConnections( ) : ConnectionList Returns a list of Connection instances representing the incoming connections forthe flow element associated with this script. The list is in arbitrary order. If there are no incoming connections the list is empty. getOutConnections( ) : ConnectionList Returns a list of Connection instances representing the outgoing connections for the flow element associated with this script. The list is in arbitrary order.
Enfocus Switch 10 instead. If the argument is null or missing, and there is no current job, and the property value is non-static, this function returns null. getPropertyEditor( Returns the name of the property editor that was used to enter the value tag : String ) : String for the specified property. In case a property offers multiple editors, this information may be required to correctly interpret the property value. If the specified tag is not defined in the script declaration, the function returns null.
Enfocus Switch 10 getJobsForConnection( Returns a list of Job instances representing all of the jobs currently c : Connection ) : waiting in the input folders for the specified incoming connection. Same JobList semantics as for the getJobs function apply. createNewJob( origin Returns a Job instance representing a new job that does not correspond : String ) : Job to an incoming job. The job is given a fresh job ticket with default values. The file path associated with the job is the empty string.
Enfocus Switch 10 because it is waiting for an external event, can invoke this function at regular intervals to determine whether it should abort its operation. Connection class An instance of the Connection class represents an incoming or outgoing connection for the flow element associated with the script (see connection and script element for background information). Connection objects can be obtained through functions of the Switch class.
Enfocus Switch 10 for an outgoing connection) as displayed in the canvas; this may be an empty string. Accessing injected properties The connection class offers the same functions for accessing injected properties as the Switch class; the function descriptions are not repeated here. Only outgoing connections have injected properties.
Enfocus Switch 10 • Create the output(s) in the temporary location. • Call one of the sendTo functions for each output. If the incoming job is passed along without change the Job.sendTo() functions can be called directly on the incoming job path, skipping all intermediate steps. Based on the above scenario, Switch automatically handles all complexities: • Moving and copying jobs to the appropriate output connections. • Providing outgoing jobs with a unique name prefix.
Enfocus Switch 10 A file matches if its filename extension and/or its Mac file type (after conversion) match the specified filename extension. A folder matches if any of the files at the topmost level inside the folder match the specified type. These semantics are similar to those of matching cross-platform file types in filter connections. isFile( ) : Boolean Returns true if the job is a single file, false otherwise. isFolder( ) : Boolean Returns true if the job is a folder, false otherwise.
Enfocus Switch 10 To successfully complete processing of a job, the script must call exactly one sendTo() function for each generated output file/folder (i.e. there may be multiple sendTo() calls for the same job). If there is no output, the script must call the sendToNull() function. It is allowed to defer these calls to a subsequent entry point invocation (for example, when grouping multiple incoming jobs in a job folder).
Enfocus Switch 10 • One of the temporary paths returned by Job.createPathWithName/Extension(). • A file inside a folder located at one of the temporary paths, which is useful in case the script can control the location but not the name of the output file to be sent along (because some other process determines it). • Any other path, which is useful in case the script can’t control the location of the output file to be sent along (because some other process determines it).
Enfocus Switch 10 sendToFilter( path : String, Sends a file/folder to all outgoing connections with a file filter name : String ) that matches the file/folder being sent. If there is no such connection, fail() is invoked instead with an appropriate error message. The flow element must have outgoing filter connections without folder filter properties, otherwise this function logs an error and does nothing.
Enfocus Switch 10 Logging Switch automatically issues the appropriate log messages when a script invokes the one of the Job.sendTo() or Job.fail() functions. A script can call the function described below to log additional job-related messages. log( type : Number, message : String, extra : String or Number ) Logs a message of the specified type for this job, automatically including the appropriate job information. See the description of the Environment.log() function for more information on the arguments.
Enfocus Switch 10 The update functions do not affect jobs that have already been sent (by calling one of the Job.sendTo() functions). They do affect any jobs that will be sent after calling the update function. setHierarchyPath( segments : String[ ] ) Replaces the location path in the hierarchy info associated with the job to the list of segments in the specified Array. The topmost path segment is stored at index 0.
Enfocus Switch 10 has been held in some location for a long time, to avoid that the job would be unduly processed before other jobs. Managing external metadata datasets The functions described here allow associating external metadata with a job's internal job ticket. The Dataset classes in the metadata module implement each of the supported metadata data models: XML data model, JDF data model, XMP data model, and Opaque data model.
Enfocus Switch 10 • A read-only dataset if the “writable” argument is set to false or if Switch does not support updating metadata for the file format of the backing file. If the function is called again on the same job in the same entry point, it returns the embedded dataset object that was created in the first call, ignoring the “writable” argument in the repeat calls. Note: A writable dataset keeps its backing file (the job!) open for update.
Enfocus Switch 10 getMostRecentOccurrence( type Returns the most recent Occurrence instance of the specified : String ) : Occurrence type associated with the job, or null if there is no such instance. If the type argument is missing or null, the most recent occurrence is returned regardless of its type. Evaluating variables These functions obtain the value of a single variable in the context of the job (and if needed, in the context of a flow element).
Enfocus Switch 10 missing, null or the empty string, the user’s default system font location is used instead. deactivateFonts( ) Undoes the effect of any prior invocations of activateFonts() in this entry point. If necessary this function is called automatically when exiting the entry point, however it is good programming style to call it explicitly.
Enfocus Switch 10 getElement( ) : String Returns the name of the flow element (as displayed in the canvas) causing this occurrence. getOrigin( ) : String Returns an indication of the origin of the job before it was injected in the flow by this occurrence. For example, a Submit point writes the absolute path of the original job (on the client machine) in this attribute. This attribute is meaningful only for ‘Produced’ occurrence types. This function returns the empty string for other occurrence types.
Enfocus Switch 10 Note: This function returns the localized message derived from the operation attribute and the relevant message arguments using the algorithm used for log messages. List classes: ConnectionList, JobList Due to implementation limitations Switch is unable to return an array of Connection, Job or Occurrence instances. Instead, it returns a helper object of the corresponding list class, that is, ConnectionList, JobList or OccurrenceList respectively.
Enfocus Switch 10 With the default prefix map the query expression can use any of the prefixes that occur in the backing file. While this is certainly not according to the book, the conventions for the use of prefixes are often stable enough to allow this sort of convenience trick. Adding/accessing mappings in a Map object put( prefix: String, namespaceURI: String ) Adds the specified prefix to URI mapping to the map, replacing the previous mapping for this prefix if any.
Enfocus Switch 10 Creating prefix maps createEmptyMap( Returns a new empty prefix map object. ) : Map createDefaultMap( Returns a new prefix map object that already contains all mappings that ) : Map occur in the backing file. For an Opaque dataset this function returns an empty prefix map object. For XML and JDF datasets, the default namespace (if any) is included in the default map with one or more special prefixes. This allows XPath queries to refer to the default namespace using these special prefixes.
Enfocus Switch 10 Result data types The value of an XPath expression can have several data types (a node set with several elements, the text value of an attribute, a number returned by the count() function, the Boolean result of a comparison). The value is converted to one of the data types string, number, or Boolean using XPath 1.0 semantics – which may very well differ from the conversion semantics in the scripting language. For example the XPath 1.
Enfocus Switch 10 Generic XPath querying The JDF data model implementation offers two types of query mechanisms. The first mechanism allows evaluating an arbitrary XPath 1.0 expression with the same semantics as those in the XML data model, i.e. the expression's value is converted to one of the data types string, number or Boolean using XPath 1.0 semantics.
Enfocus Switch 10 into a single string. Leading and trailing whitespace is removed. Whitespace including linebreaks may occur in the body of the string. getNumber( xpath : String, prefix-map: Map ) : Number Same as getString but interprets the string as a decimal number with support for negative and positive infinity (-INF and INF) as per the JDF specification. Numbers outside the range of the scripting language are clipped to negative of positive infinity.
Enfocus Switch 10 hasStruct( xmp-path : String, prefix-map : Returns true if there is a structure property at the Map ) : Boolean XMP location path. hasArray( xmp-path : String, prefix-map : Map ) : Boolean Returns true if there is an array property at the XMP location path. hasAltTextArray( xmp-path : String, prefix-map : Map ) : Boolean Returns true if there is an Alt-Text array property at the XMP location path (that is, an array property of type “Alt” with leaf properties as children).
Enfocus Switch 10 a "generic" language that may be used if there is no specific language match. The generic language must be a valid RFC 3066 primary subtag or the empty string. For example, a specific language of "en-US" should be used in the US, and a specific language of "en-UK" should be used in England. It is also appropriate to use "en" as the generic language in each case.
Enfocus Switch 10 • When the entry point in which the dataset was created returns. Setting leaf values The set functions described below set the value of a leaf property. They succeed if: • The specified property exists and it is a leaf property: the property value is updated. • The specified property does not exist, but its immediate parent does exist and it is a struct: the property is created with the specified name and its value is set.
Enfocus Switch 10 modified. If the array only has 1 existing item (which is not x-default), an x-default item is added with the given value. If the selected item is from a match with the generic language and there are no other generic matches, the value of that item is modified. If the existing value of that item matches the existing value of the x-default item, the x-default item is also modified.
Enfocus Switch 10 Removing properties removeProperty( xmp-path : String, Removes the property at the specified XMP location path prefix-map : Map ) and the complete sub-tree rooted at the property. If the property does not exist the function does nothing. Opaque data model The Opaque data model describes a class that inherits all functions described in the Dataset class; it does not add any functions to those of the Dataset class.
Enfocus Switch 10 matches if its filename extension and/or its Mac file type (after conversion) match the specified filename extension. This function does not examine the file contents. isFile( ) : Boolean Returns true if the file exists, false otherwise. getByteCount( ) : Number Returns the size in bytes of the file, or zero if the file doesn’t exist. getCreated( ) : Date Returns the creation time of the file, or null if the file doesn’t exist.
Enfocus Switch 10 Filename extension Description MOV QuickTime movie MP3 MP3 sound PDF Adobe PDF (Portable Document Format) PNG PNG image PS Adobe PostScript PSD Adobe Photoshop TIFF TIFF image WAV Wave sound getFileFormat( ) : String Returns the format of the file contents (as one of the strings in the first column of the table above), or the empty string if the format is not recognized or if the file doesn’t exist.
Enfocus Switch 10 getDate( query : String ) : Date Returns the requested statistic as a date-time.
Enfocus Switch 10 Statistic name Data type Supported for Description ICCProfile String JPEG, TIFF, PNG The name of ICC color profile used, if any Colorants String list TIFF A list of the names of all colorants for Duotone or Multichannel images; the list is empty for all other color models CellWidth Integer TIFF The width of the dithering or halftoning matrix used to create a dithered or halftoned bilevel file CellLength Integer TIFF The length of the dithering or halftoning matrix used t
Enfocus Switch 10 Statistic name Data type Supported for Description SecurityMethod String PDF The method used to protect the document; possible values: "None", "Password", "Certificate", "LiveCycle" PDF media boxes The FileStatistics class offers the following additional statistics for the PDF file format: Statistic name Data type Description PageBoxesEqual Boolean True if all pages have identical page boxes; false otherwise (verifies media, crop, bleed, trim and art box) MediaBoxWidth Ratio
Enfocus Switch 10 Statistic name Data type Description PDFXVersionKey String The contents of the PDF/X version key in the document, or the empty string if there is no such key; one of the following values may be returned: • PDF/X-1a:2001 • PDF/X-3:2002 • PDF/X-1a:2003 • PDF/X-3:2003 • PDF/X-4 • PDF/X-4p The PDF/X version key indicates a claim that the document conforms to the PDF/X specification, but it does not offer any guarantees PDF page content The FileStatistics class offers the follow
Enfocus Switch 10 Statistic name Data type Description • Composite CP2 data model The CP2 data model (part of the metadata module) describes a class that inherits all functions of the XMP data model and all functions of the Dataset class. The following subsections describe the functions specific to the CP2 data model. Overview Since most Certified PDF 2 information is stored as XMP, the “CP2” data model inherits from the “XMP” data model.
Enfocus Switch 10 Other XMP Metadata It is perfectly valid however to access any other XMP metadata (i.e. unrelated to Certified PDF 2) using the regular XMP access functions on the CP2 dataset, even intermixed with the use of functions specific for the CP2 data model. Note: This requires the CP2 data model implementation to update the Certified PDF 2 information independent of the rest of the XMP packet or – if this is not possible – to detect any regular XMP updates and synchronize when needed.
Enfocus Switch 10 (not counting any sessions automatically added while obtaining the dataset); returns false otherwise. If hasValidSignature() returns true, hasPreviousSessions() should return true as well (unless some application has created a corrupt Certified PDF 2 file). However if hasValidSignature() returns false, hasPreviousSessions() may still return true.
Enfocus Switch 10 Note: After implementation, the scripting API should remove any PDF objects associated as private data with removed or stripped sessions or with removed certificates. getAllSessions( ) : Returns a list of all sessions in the dataset, including the active session, in order of occurrence (that is, the active session is the last session in the list).
Enfocus Switch 10 Updating certificates Certificates other than those associated with the active session cannot be updated. It is possible however to completely remove any certificate. Note: After implementation, the scripting API should remove any PDF objects associated as private data with removed certificates. The scripting API does not support influencing the order of certificates.
Enfocus Switch 10 class properties). Such a class may need to be implemented within the toolkit (so that special hacks can be applied). removeCertificateAt( Removes the certificate at the specified zero-based index (in the list index : Number ) returned by getAllCertificates). [W] After completion of this function, the indexes for the remaining certificates may have shifted and references to the removed certificate may have become invalid.
Enfocus Switch 10 Object Session Property CP2:session_id Exposure Not exposed Session CP2:start_byte CP2:user_id_ref CP2:start_time Read-only CP2:end_time Session CP2:tool_id Read-only CP2:tool_version CP2:tool_desc CP2:appl_id User Certificate Certificate Other required properties CP2:appl_version CP2:appl_desc CP2:user_id CP2:session_id_ref CP2:time Not exposed Not exposed Read-only For sessions and users all required properties are automatic.
Enfocus Switch 10 zones must be added. Adding an editing zone to a session has the following effect on any certificates that are sensitive to that zone: • If the certificate resides in a previous session it becomes dirty. This is a consequence of the definitions in the Certified PDF 2 file format specification; there is no need to update the certificate. • If the certificate resides in the active session, its state is automatically reset to “Unknown”.
Enfocus Switch 10 createDefaultMap( ) : Map For a CP2 dataset, the “cp2” prefix (with corresponding namespace) is always included in the map, even if the underlying XMP does not define it (because if does not contain Certified PDF 2 metadata or because it uses another prefix). Otherwise the function behaves as before. XMP data model The following functions offer slightly expanded semantics.
Enfocus Switch 10 Work with a single value For each localized property the scripting API offers a getter and a setter working with a single string value: • The getter returns one of the available alternates, selected by preference in the following order: the English language string, the default string, or any other language string. The getter returns a non-empty string as long as there is at least one alternate string.
Enfocus Switch 10 the complete set of language alternates for each item. The returned AltText objects are read-only. getUser( ) : User Returns the user object referenced by this session (through CP2:user_id_ref), or null if the session doesn’t reference a user. getDataMap( ) : DataMap Returns a data map referencing the collection of private data for this session (CP2:data), which is empty if the property is absent. For the active session, the returned DataMap object is writable.
Enfocus Switch 10 setComment( value : String ) Sets the user-supplied comment that describes the changes to the PDF file during this session (CP2:comment). This function sets the English language alternate and erases all other alternates. To set other language alternates, use appropriate setters on an AltText object obtained with getCommentLocalized().
Enfocus Switch 10 getTypeDescription( ) : String Returns the human-readable description of this certificate’s type and version (CP2:type_desc). This function returns the English language alternate, or the empty string if the property is absent. getTypeDescriptionLocalized( ) : AltText Returns the human-readable description of this certificate’s type and version (CP2:type_desc). This function returns the complete set of language alternates, which is empty if the property is absent.
Enfocus Switch 10 getStateDescription( ) : String Returns the human-readable description of the state of this certificate (CP2:state_desc). This function returns the English language alternate, or the empty string if the property is absent. getStateDescriptionLocalized( ) : AltText Returns the human-readable description of the state of this certificate (CP2:state_desc). This function returns the complete set of language alternates, which is empty if the property is absent.
Enfocus Switch 10 isValid( ) : Boolean Returns true if this certificate is valid, false otherwise. A certificate in any session other than the active session is valid if and only if all of the following conditions apply: • The certificate resides in a Certified PDF file with a valid signature. • The certificate’s state is not “Unknown”.
Enfocus Switch 10 appropriate setters on an AltText object obtained with getImplementationDescription(). setStatementDescription( value Sets the human-readable description of the statement made by this certificate (CP2:statement_desc). This function sets the : String ) English language alternate and erases all other alternates. To set other language alternates, use appropriate setters on an AltText object obtained with getStatementDescriptionLocalized().
Enfocus Switch 10 getCountry( ) : String getEMail( ) : String getPhone( ) : String getFax( ) : String getUserMessage( ) : String Returns the user-supplied message associated with this user (CP2:message). This function returns the English language alternate, or the empty string if the property is absent. getUserMessageLocalized( ) : AltText Returns the user-supplied message associated with this user (CP2:message).
Enfocus Switch 10 Storage type base64 ref Storage form Encoding Base64 encoded Binary stream PDF object data stream Binary (i.e. outside of the XMP packet) Recommended for short data streams longer data streams Note: The scripting API fully supports the “ref” storage type; it implements the appropriate methods to read and write data from and to PDF objects and registers these methods with the C++ toolkit. Getters [R] isEmpty( ) : Boolean Returns true if the collection is empty, false otherwise.
Enfocus Switch 10 put( tag : String, contents : ByteArray, asPDFObject : Boolean ) Places a private data item of storage type “base64” or “ref” in the collection with the specified tag and contents. If an item with the same tag already existed, it is replaced by this new item. If asPDFObject is false, the item is of storage type “base64” and the binary data is encoded as Base64 before being stored in the XMP packet.
Enfocus Switch 10 These helper classes offer functions to access the items in the list, identical to the functions offered by the list classes in the flow element module (JobList etc). Implementation note on Exceptions The scripting API does not throw exceptions. All C++ toolkit exceptions must be caught within each scripting API function. In some cases the scripting API function description may describe what to do if an exception is caught (for example, return a null object).
Enfocus Switch 10 19. Data Collecting Wizard 19.1 Task description The Data collecting wizard tool helps in collecting data from files which may be required by the support team when they need more information on the setup. The data from the following files are collected by the tool and sent to the support team after creating a zip package: • • • • • • • • Exported sflows Preference files Job tickets logs .
Enfocus Switch 10 Therefore the tool exists in two places: as a functional part of Designer and also as a standalone executable. The standalone Wizard is called PowerSwitchDataCollector.exe or PowerSwitchDataCollector.app. When the flavor of the Switch is Full or Light, the name of the wizard corresponds to the flavor. For example: FullSwitchDataCollector.exe and LightSwitchDataCollector.exe etc.
Enfocus Switch 10 a. ‘Logs’ – Server logs in .db3 file (entire folder "\logs"). This checkbox is enabled so users can deselect it if required. b. ‘Preferences’ – Switch preferences XML (entire folder "\settings"). This checkbox is disabled by default. c. ‘Internal jobtickets’ – All *.ijt files (entire folder "\tickets"). This checkbox is disabled by default. d. ‘Datasets’ – jobs datasets (entire folder "\datasets").
Enfocus Switch 10 Note: Flows are not exported as "sflows" files but as raw data, that is the following folders are placed as is in the zip package: "\flows" and "\PropertySets" Note: It is recommended that Switch is not processing when data is being collected. Therefore at startup, the standalone wizard verifies if Switch is running or not. When the wizard is launched from the designer and starts collecting data, it deactivates all active flows.
Enfocus Switch 10 The Next button is disabled. Exit the Switch application and relaunch the wizard from the standalone executable and proceed as explained earlier. 19.4 Resulting zip package The structure of the resulting zip package is very simple, each data part is placed in a separate sub-folder. For example: PowerSwitch Data 2010-08-10 10-46-11.
Enfocus Switch 10 Index A Activating extra client license 22 Activation licenses 21 Advanced topics 86, 184 alttext class 511 AppleScript 139 compiled binaries 139 extensions 139 Application 233 Archive hierarchy 224 Assemble job 229 B Basic concepts 76 C Certificate class 504 Certified PDF 255 challenges 513 Checkpoint 270 Checkpoint via mail 273 compatibility 143 Compress 237 Configuration 145 Connections Checkpoints 270, 273 Contact Enfocus 14 D Data collecting wizard 513 Database 438 datamap class 5
Index Flows (continued) importing 74 layout 82 library 13 locking 72 managing 61 markers 69 metadata 280 new 61 organizing 68 processes 111 processing 280 properties 70, 81, 184 removing 70 running 103, 210 scripts 132 selecting flow elements 80 sending notifications 66 setting markers 69 Submit points 150 tools 237 unlocking 72 validating connections 79 viewing 103 wizard 67 Folder 216 Folders 44, 78, 87, 88, 99, 182, 216, 219, 220, 224, 225, 237 compressing 237 connections 78 filters 99 folders pane 44 h
Enfocus Switch 10 Opaque pickup 284 Preferences 17, 90, 184, 186, 187, 188, 189, 191, 357 application data 189 error handling 188 execution modes 357 file types 186 FTP proxy 186 internal communication 191 language packs 17 mode of operation 90 originals 90 processing 187 user interface 184 Problem jobs 219 Problems activation 176 categories 112 connections 79 deactivation 176 error handling 188 error messages 175 execution problems 114 file types 186 licenses 173 licensing 152 problem alerts 188 problem
Index Rename job 248 resulting zip package 517 roles 150 Running Switch 16, 18, 19, 29, 181 first time 19 limited user 18 service 181 versions 29 S Script element 256 Scripting API 134, 367 AppleScript 205, 206, 207 array 371 Attr 431 AttrList 431 boolean 374 built-in functions 388 built-in objects 371 built-in operators 390 built-in types 371 ByteArray 410 Comment 431 comparing 124, 295 concepts 130 configurators 347 Connection 462 ConnectionList 476 control statements 400 CP2 data model 493 data types 2
Enfocus Switch 10 Support 14 Switch product family 15 Switch server 156, 181 Switch User Group 14 Switch Watchdog 181 SwitchClient 50, 143, 150, 152, 153, 155, 156, 159, 164 access rights 150 communicating 143 connecting 156 connections 156 installing 152 jobs 159 log messages 164 preparing 143, 153 running 153 system requirements 152 SwitchClient notifications 156 SwitchScripter 49, 333, 334, 335, 336, 339, 340, 343 declaration pane 335 entry points 343 fixture pane 336 message pane 340 program pane 339 p