Automation Engine Script Guide > Introduction > First Steps > Script Variables

Script Variables

Objectives:
- Creating script variables
- Assigning values to variables
- Printing variable values

Lesson 3

Script variables can be used to store and pass on values in scripts. For example, you can use them to obtain the return code of a particular script function.

You can create script variables with a particular data type. The data type is decisive for the values that can be stored in script variables. The following data types are available:

Variable names start with a & character; the second character must not be a number.

 

We will now create two script variables, assign values to them and have the values output in the activation protocol:

Open any executable object of your choice and open the Process tab.

Create the first script variable by using the script element :DEFINE. The data type must be defined and cannot be changed subsequently. Select the data type "signed" because the variable should store a negative number. Now use the script element :SET in order to assign a value.

:DEFINE &number#,signed
:SET &number# = -1

Create the second script variable directly with :SET and set it to the value "test". In this case, the variable can subsequently be changed to any value of your choice. This means that the data type depends on the value.

:SET &string# = "test"

Use the following scripting line to write the values of both variables to the activation protocol. You must use the & character twice in order to have the variable name output.

:PRINT "&&number# = &number#, &&string# = &string#"

Store and execute the object. The activation protocol now includes the following line:

2011-04-06 14:48:17 - U0020408 &number# = -0000000000000001, &string# = test

 

More detailed information about script variables is available here.