Script

The Script component enables users write Visual Basic scripts. Using this component, users can execute visual basic code to perform a wide range of operations.

Screenshot

Supported Functions

Double click on the Script component title bar to launch the Script Editor Window.

Screenshot

  1. Parameters section allows a user create input variables (by clicking on the Screenshot icon) and use them in a script. Once a parameter is created, it can be renamed and its data type changed. For each parameter that is created, Script component will expose a Data In port.
  2. Script section is where the VB Script is entered.
  3. Click on the Validate button to verify the VB Code block.
  4. If there is any error in the VB code block, it can be viewed in the Error section
  5. In the Return Type section, users can define the return data type.

Ports

The Script component exposes Control In, Control Out, and Data Out ports by default.

Port Description
Control In Must be connected to the Control Out port of one or more components.
Control Out Must be connected to the Control In port of any other component.
Data In- Dynamic Must be connected to Data out ports from where input values are to be derived (Object).
Data Out Must be connected to the Data In port of another component from where data is to be collected. Script component can return any type of data, such as objects, stings or integers.

Properties

To edit the properties of the Script component, in the Properties window, change the required property. Users can edit the following properties:

Property Description
Search Search for the respective property.
Delay After Execution Specifies the wait time (in seconds) after the action is executed.
Delay Before Execution Specifies the wait time (in seconds) before the action is executed.
Name Specifies the name to identify the component. Set the name to match the application field being interacted with.

Example

Let us consider an example of adding two numbers.

Screenshot

To use the Script component:

  1. In the Toolbox, expand General.
  2. Drag the Script component and drop it in the design surface.
  3. Double-click the title bar of the script component.
    The SCRIPT EDITOR dialog box is displayed.

    Screenshot

  4. In Script(VB.NET), enter a code to be executed.
    In this example, a code for adding two numbers is entered.

  5. Click VALIDATE to check the code for errors.
  6. Click Screenshot to define the two variables users have added to the code.
  7. Edit the name and the type of variable for the added parameters.

    Note

    To remove the parameters, click Screenshot

    Screenshot

  8. Click OK.
    The design surface displays the process flow.

  9. In this scenario to add an input value, Users must add the variable component.

  10. To add the Variable component:

    • In the Toolbox, expand General.
    • Drag the Variable component and drop it on the Design surface.
    • Double-click the Variable component, click on the Screenshot icon and enter the input values for both the variables.
  11. Add a MessageBox Show component to display output of the Script component.

  12. To add the MessageBox component:

    • In the Toolbox, expand General.
    • Expand the MessageBox Show component, and drag Show component and drop it on the design surface.
  13. Connect:
    • The control ports of all components.
    • The Data Out ports of the values for different variables in the Variable component to the Data In ports of the respective parameters of the Script component.
    • The Data Out ports of the Script component to the Data In ports of the MessageBox component.
  14. In the toolbar, click Run.
    The output of the code entered in the Script component is displayed.

    Screenshot