Script

Use the OpenSpan Script component to write custom C# methods for use in automations.  The Script component can contain multiple methods.

This topic describes:

 

Script Component and Associated Files

When adding this component to an automation, it is placed in the Global tab of the component tray by default. See the Adding Global Components to an Automation for more information on the Global tab. This component must be Global to be referenced by other automations in the project.

When you add a Script component to a solution and create at least one method for the Script, OpenSpan creates an assembly file (Script-identifier.dll) for the Script component. This file, along with .dll files required for any of the other OpenSpan components that generate dynamic assemblies, are stored in the user's %LocalAppData% folder. These assembly files are used by OpenSpan Studio during project design only.

When you create a runtime deployment package for the project, the dynamic assembly created for the project contains all of the required component assemblies.

Creating Script Methods - Overview

To create Script methods, launch the Script Constructs dialog. You can open this dialog by:

See the Using the Script Component topic for more information on the Script Constructs dialog.

 

Script Component Properties, Methods and Events

The properties, methods, and events specific to the Script component follow. For information on properties, methods and events common to all OpenSpan components, see the General Component Properties Methods Events topic.

Properties

Property

Description

CodeConstructs

Use this property to open Script Constructs dialog for creating custom methods using C#.  A Script may contain multiple methods. See the Script Constructs topic for more information.

Errors

If a method fails validation, messages describing the error display in this property.

References

Use this property to open the Script References dialog for specifying any external assemblies that the methods will require. Add the assembly/assemblies using this property before editing the Script and using the references in the Script methods.  You can add assemblies from:

  • OpenSpan application folder

  • GAC assemblies

  • Dynamic Assemblies (created when certain OpenSpan components, such as Expressions, are used

Note: You can also set the Script References by right-clicking on the Script component and selecting Edit References.

An example of the Script References dialog is shown below where the Microsoft.Office.Excel.Interop assembly has been added from the GAC:

 

Valid

Displays a value of True or False indicating whether the syntax of the methods is accepted by OpenSpan Studio.

 

Methods

Method

Description

Parameters

Result Type

Method Name

 

When you create a method using the CodeConstructs property, it appears in the object explorer to use in the automation along with the input and output parameters defined in the code. The method name can contain spaces.

 

As required by Script method

As specified by Script method

 

See also

Using the Script Component