Associate a Mimic Script with a Script Pick Action

When you have created a script, you can associate it with a pick action so that the script is run when a specific Mimic item is selected.

To associate a script with a pick action for a Mimic item:

  1. In Design mode, double-click on the Mimic item that will be selected to run the script.
    The Properties window is displayed (the type of Properties window varies according to the type of Mimic item).
  2. On the General tab, select the Pick Action button.
    The Pick Action Configuration Wizard runs.
  3. On the first 'page' of the Wizard, select the Script option then select the Next button.
  4. On the second 'page' of the Wizard, define the following settings:

    • Mode—Choose from:
      • Call Specific Function—When the pick action is selected, a specific function will be called. The function is selected in the Function combo box and is a function from a script.
      • Execute Code Fragment—When the pick action is selected, part of a script is executed.

        Enter the section of script that is to be executed in the Code field. Typically, you would enter code to call a function declared in the script that has been created for the Mimic.

      • Execute Code Fragment on Top Level Mimic—Designed for use on embedded Mimics, the Execute Code Fragment on Top Level Mimic mode allows part of a script to be executed on the Mimic that contains the embedded Mimic. So when you select the embedded Mimic’s pick action, the script segment that you define will run on the top level Mimic (the Mimic that contains the embedded Mimic).

      You have to define the section of script that is to be executed in the Code field. Typically, you would enter code to call a function declared on the top level Mimic.

    • Function—This combo box is only available when the Mode is set to Call Specific Function. Use the combo box to select the specific function that is to be called when the pick action is selected. If the function in your script or script library shares the same name as a function that is in another script or script library that is also being used by the Mimic, only one of the functions will be available. For this reason, take care when naming functions in your scripts and script libraries.

      If a Mimic is to use functions from its script and one or more script libraries, you should set the functions in the script and script libraries to have unique names (they need to be unique in the script and the script libraries used by the Mimic, but do not have to be unique on the system).

    • Code—This text entry field is only displayed if the Mode is set to Execute Code Fragment or Execute Code Fragment on Top Level Mimic. In the Code field, type or paste the fragment of code that is to be executed when the pick action is selected.
    • Permission—Use this combo box to select the security level for the pick action. The pick action will only be available to users that have the selected permission allocated to their User account. For more information on User accounts and permissions, see User Accounts in the Geo SCADA Expert Guide to Security.
  5. Select the Next button.

    If the selected function requires arguments, proceed to step 6. If the function does not require arguments, proceed to step 9.

  6. On the third 'page' of the Wizard, define the values for the arguments:

    This 'page' lists the available arguments. The name of the argument is shown in the Name column, the required data type is shown in the Type column, and the expression for the argument is shown in the Value column.

    1. Right-click on the argument that you want to configure.
      A context sensitive menu is displayed.
    2. Select the required option:
      • Edit—Displays the Expressions window that you can use to configure an expression for the argument. Proceed to step iii.
      • <Pre-Defined Argument>—Depending on the type of function you have selected, there may be pre-defined argument options. These options correspond to the arguments that are defined in the Mimic's script.

        If you select any of these options, the value for the argument will be set to match the corresponding value in the Mimic's script.

        If you select a <Pre-Defined Argument> option, the selected argument is shown in the Value column. Proceed to step v.

    3. Use the Expressions window to create an expression that defines the argument value.

      For more information, see Using the Expression Editors in the Geo SCADA Expert Guide to Expressions.

    4. Select the OK button to confirm the expression and close the Expression window.
    5. Repeat steps i-v for each argument as required. When you have defined the required arguments, proceed to step 7.

      To remove the expression for an argument, right-click on the argument in the list then select the Clear option.

  7. Select the Next button.

    If you are creating a script for a button, you will need to repeat steps 4-6 inclusive for when the button is up (not pressed down).

  8. Enter a Pick Action Comment as required. The pick action comment is displayed in the status bar when the cursor is positioned over the relevant Mimic item.
  9. Select the Next button.
  10. Select the Finish button to complete the pick action configuration.

When the Mimic is displayed in Run mode, selecting the Mimic item for which you configured the pick action will cause a script or part of a script to run.


Disclaimer

Geo SCADA Expert 2019