Variable Data

InstallShield 2022 » InstallScript Language Reference

A variable is a named data item whose value can change during program execution.

Variable Declaration

Format

A variable must be declared in the following format:

    data_type  VariableName1[, VariableName2 [,...]];

Rules

Variable declaration must follow these rules:

A variable name can have a maximum of 32 characters.
When more than one variable name is specified in a single declaration, the names must be separated by commas.
Each variable declaration must be terminated with a semicolon.

Caution:The names of InstallScript variables and functions are case sensitive. For example, svItemCounter is not equivalent to svITEMCOUNTER.

Variable Declaration Example

In the following example, seven variables are declared. Note that the last declaration creates three numeric variables.

    BOOL bValidEntry;

    

    LONG lPopulation;

    

    //String explicitly sized

    STRING szUserName[128];

    

    //String autosized

    STRING szMessage;

    

    NUMBER nFileSize, nDirSize, nDiskSpace;

Declaring String Variables

You can declare a string variable with or without an explicit size. String variables that are not declared with an explicit size are then sized automatically during a setup to accommodate the values assigned to them. Autosizing is recommended for all string variables except those that will be passed to an external (DLL or Windows API) function—in these cases, the string's size must be declared explicitly. The maximum size of a string is 65534 characters.

See Also