Script parameters

The project automation system enables your script to prompt the user for entering some parameters. Such parameters are then used (as variables) by your script.

Principle:

Parameters must be variables of your script project declared as global variables. Then you need to create a list of variables in your script project that groups all "parameter" variables. Finally in your script, you must call the paEditParameterList function, that opens a dialog box where the user must give values for each parameter. Then "parameter" variables can be used in your script.

A parameter must be a variable declared with a single data type (no array, no structure). All basic data types are supported. When the parameter input dialog box is open, current values of variables are shown as default value.

For a string parameter, it is possible to define a drop-list choice. For that you must set possible choices in the string value before editing parameter, separated by '|' characters. e.g.: 'Choice1|Choice2'.

Related functions:

paSetParameterDesc - Set the description text to be shown with a parameter
paEditParameterList - Prompt the user for entering parameters

See an example...

Below is detailed information about these functions

paSetParameterDesc - Ses the description text to be shown with a parameter

OK := paSetParameterDesc (NAME, DESC)

Parameters:

NAME : STRING; Name of the parameter, such as declared in your script project
DESC : STRING; Description text to be show to the user when entering parameters
OK : BOOL TRUE if successful

Description:

This function defines the description text to be shown together with the specified parameter when entered.

paEditParameterList - Prompt the user to enter parameter values

OK := paEditParameterList (LISTID, TITLE)

Parameters:

LISTID : DINT; ID of the list of parameters (use VLID function)
TITLE : STRING; Title of the window where the user enters the parameter
OK : BOOL; TRUE if the use pressed the OK button

Description:

This function opens a dialog box where the user enters values for script parameters.

Example

This examples shows the different steps for adding parameters to a script:

1- Declare parameters as global variables of your script project:

       

2- Create a list of variables with parameters:

       

3- ST Script:

    // set decription text for parameters
    paSetParameterDesc ('Param1', 'This is parameter 1');
    paSetParameterDesc ('Param2', 'This is parameter 2');
    paSetParameterDesc ('Param3', 'This is parameter 3');
    // prompt the user for parameters
    paEditParameterList (VLID ('Parameters'), 'Enter parameters now');

When the script is run, the following dialog box is open:

       

The "Param1" parameter is a check box, because it is declared as BOOL. The "Param3" is shown as a drop list because the value of "Param3" (its initial value in that case) is a list of words separated by '|' characters.