You are here: Core Reference > Coding > Scripting > Set a Script to Run when a Mimic is First Displayed in Run Mode

Set a Script to Run when a Mimic is First Displayed in Run Mode

You can use the Mimic_ Load function to set a script to run when the Mimic that contains the script is displayed in Run Mode. This means that the script will run when a User accesses the Mimic (the script does not have to be triggered by any other form of user interaction).

If you are using a script that requires parameters that are specified as part of a hyperlink, you have to use the Mimic_Navigate function instead of the Mimic_Load function. This is because the Mimic_Load function runs as soon as the Mimic opens (that is, before the parameters from the hyperlink have been read). The Mimic_Navigate function works in exactly the same way as the Mimic_Load function except that it runs at a later stage, and so it allows parameters to be read from hyperlinks.

To set a script to run automatically when a Mimic is first displayed in Run mode, simply include a Mimic_Load or Mimic_Navigate function in your script. The Mimic_Load function instructs the system to run the script when the Mimic is first displayed in Run Mode. The Mimic_Navigate function has a similar effect, but it allows hyperlink parameters to be used as it runs in a later stage of the Mimic opening sequence.

NOTE: Mimic_Load and Mimic_Navigate functions only run when the Mimic is displayed in Run Mode.

The syntax for using the Mimic_Load function is:

Sub Mimic_Load()
End Sub

Mimic_Load is designed to be used with top-level Mimics only, and should not be used in scripts on embedded Mimics. This is because it is difficult to predict when the script will run:

For the Mimic_Navigate function, a similar syntax is required:

Sub Mimic_Navigate( )
End Sub

As Mimic_Navigate is designed to run when users navigate from top-level Mimic to another, it is unsuitable for use on embedded Mimics (Mimic_Navigate will not run on embedded Mimics).

NOTE: The Mimic_Load and Mimic_Navigate functions have no parameters.


ClearSCADA 2015 R2