Reference a Script Library in a Script

When you have created one or more Script Libraries, you can reference them in your scripts. The reference allows your Mimic or Alarm Banner script to run the code that is stored in the Script Library as if the code were included in the Mimic or Alarm Banner script.

Example:

Ten Mimics require a script that causes a Form with two user-entry fields to be displayed. Rather than re-enter the code for creating a Form with two fields ten times, the Form with two fields code is saved in a Script Library. Then a reference to the Script Library is added to the scripts for each of the ten Mimics.

One of the Mimics is displayed and its script runs. This causes a Form with two user-entry fields to be displayed, as the Mimic script runs in the same way as if it actually contained the code that is stored in the referenced Script Library. Every one of the ten Mimics will behave in the same manner—they will run their own scripts as if they contain the code that is in the Script Library.

To reference a Script Library in a script:

  1. Display the Script Editor for the script (see Display the Global Script Editor or see Display the Script Editor for a Mimic).
  2. Perform one of the following:
    1. Right-click on the background of the Script Editor to display a context sensitive menu.
    2. Select the Libraries option.

    Or:

    1. Go to the Library command group on the Script tab.
    2. Select the Libraries command.

    The Libraries window will display.

  3. Use the Libraries window to select the Script Libraries that you want to reference in your script:
    • Select the check box next to the name of a Script Library to reference the Script Library in your script. The selected Script Library can now be used in your script—you can reference the functions by name in the same way that you would reference any function in VBScript.
    • Clear the check box next to the name of a Script Library to remove the reference to the Script Library from your script. The Script Library can no longer be used in your script.

    You can access the script of a Script Library by double-clicking on the required Script Library in the Libraries window. The script is displayed in a new Script Editor window.

If you are creating a Mimic script, you can also choose the functions from the Function combo box that is available when you configure a Script pick action (see Associate a Mimic Script with a Script Pick Action).


Disclaimer

Geo SCADA Expert 2019