Creating Variables

There are three types of values recognized by Terminal Emulation scripting: Booleans (TRUE or FALSE values), numbers (integers), and strings. Every action that returns a value returns one of these types. Variables provide a way to save the result of an action for use later as an argument for another command.

Variables can be created and edited under the appropriate Variable tab while editing the script. It is also possible to create new variables while editing an action.

When a script first starts, all the variables will have known values: Boolean variables will be FALSE, number variables will be 0, and string variables will be empty. One possible exception to this is when a script activates another script.

When a variable is persistent, the value remains after the script exits. Persistent variables are not script- or session-specific; once a value is assigned, any script in any emulation session can use a persistent variable to access that value.

Two scripts are referencing the same persistent variable if both scripts contain a persistent variable of the same type and same name.

Writing new values to persistent variables will slow your application, so they should be used only when necessary. If you want to use a persistent variable that will change values frequently, write your script with a regular variable that only changes the value of the persistent variable before the script pauses or exits.

To create a variable:

1  Determine which type of variable you want to create: Boolean, number or string.

2  From the Script Editor, select the tab that corresponds with the type of variable you want to create.

3  Click Add.

4  In the Edit Variable dialog box, enter the name of the new variable.

Adding a New Variable

5  Enable the Make this variable persistent checkbox if you would like the variable to persist after the script exits. This allows it to be used by other scripts or sessions.

6  Click OK.

The new variable appears in the corresponding tab.

 


Was this article useful?    

The topic was:

Inaccurate

Incomplete

Not what I expected

Other

Privacy and Legal