Specifications
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).
Support for third-party application
Switch offers special support for scripted plug-ins that control a third-party application. The
reason is that information about the third-party application’s location and licensing should be
managed centrally. Rather than offering a property for each instance of the script in a flow, the
scripted plug-in’s icon in the Elements pane offers a context menu item to set the property value
once and for all.
Moreover some scripted plug-ins can automatically discover the third-party application’s location
and this should happen only once since it may be a time-consuming process.
Special properties
If a script package is loaded as a scripted plug-in, Switch treats the property tags “ApplicationPath”
and “ApplicationLicense” in a special way:
• Properties with these tags are not shown in the script element’s occurrences in a flow.
• The property values are retrieved from a central memory location managed by the context
menu items in the scripted plug-in’s icon in the Elements pane.
If the script package is not loaded as a scripted plug-in, these properties are not treated in any
special way.
Special entry points
If a script package is loaded as a scripted plug-in, the optional findApplicationPath,
licenseApplication, and getApplicationLicensing entry points help manage the special properties
discussed above in conjunction with the context menu items.
If the findApplicationPath entry point is present, this means that the scripted plug-in controls
an external application. If the entry point returns a non-empty string, this value is used as the
application path stored in the central “ApplicationPath” property. Otherwise the application
path remains empty, the scripted plug-in’s icon in the Elements pane is grayed out and a context
menu item is offered to set (or view) the application path manually.
The findApplicationPath entry point can return "/:External resource:/" if there is no application
path available, for example if it is on a network server.
The findApplicationPath entry point can use the findRegisteredApplication() and
findApplicationOnDisk() functions offered by the Environment class to help discover the third-party
application.
If the licenseApplication entry point is present, this means that the application can be licensed
through Switch. In this case the scripted plug-in’s icon in the Elements pane offers a context
menu item that displays a dialog requesting a license key. When the user enters a license key
and closes the dialog box, the licenseApplication entry point is called and the license key is
stored in the central “ApplicationLicense” property. This allows the script to perform licensing
once (in the entry point, when the key is entered) or pass the license key with every execution
(by retrieving the property value).
346
Enfocus Switch 10