www.buildautomator.com  Build Automator Documentation

Set Variable

Previous  Top  Next  


The Set Variable action is designed to be used to assign values to variables during the execution process of the action or project. 

 

Set_Variable_Assignment

 

Properties

Explanation

Variable to set

Select or enter the variable name that you want to set.  This can be used to declare a variable, or set it.

New Value  ROMx116_dblisttable

Enter the new value for the variable.  Click the button on the right to show a window to select various data elements, such as files, folders, etc.  This entry can include variables.

Operation

Here you can select the operation to perform.  The available operations are:  Assignment, Increment Value, Decrement Value, Convert to Uppercase, Convert to Lowercase and Evaluate Expression.  See below for more detailed information.

Append New...

This can be used to append the results of the New Value assignment to the current value of the variable.

 

Below is a list of the various operations that apply to the Set Variable action.  We will be documenting the functions that are available for the Evaluate Expression as we add more to the list.  Please check our Function Reference for more information.

 

Assignment

This is a direct assignment to the variable.  If "Append New Value..." is unchecked then whatever the variable contained before will be overwritten with the contents of the New Value.  If the "Append New Value..." is checked this operation will append the New Value to the existing value.

Set_Variable_Assignment

Increment Value

This increments a numeric value by the Increment value.  If a value is specified in the Initial Value, then the variable will be assign the Initial Value plus the increment value the first time it executes.  For example if the Initial Value is set to 4000 and the Increment Value is set to 1, then the first time the action is executed the variable will contain 4001.  The next time it will contain 4002, then 4003 and so on.

Set_Variable_Increment_Value

Decrement Value

This decrements a numeric value by the Increment value.  If a value is specified in the Initial Value, then the variable will be assign the Initial Value minus the increment value the first time it executes.  For example if the Initial Value is set to 4000 and the Increment Value is set to 1, then the first time the action is executed the variable will contain 3999.  The next time it will contain 3998, then 3997 and so on.

Set_Variable_Decrement_Value

Convert to Uppercase

This operation takes the contents of the Variable and converts it to uppercase.  If the New Value is set, then that value is converted to uppercase.  If the "Append new Value..." is checked, then the New Value is appended to it, otherwise the New Value is assigned to the variable.

Set_Variable_Uppercase_Value

 

Convert to Lowercase

This operation takes the contents of the Variable and converts it to lowercase.  If the New Value is set, then that value is converted to lowercase.  If the "Append new Value..." is checked, then the New Value is appended to it, otherwise the New Value is assigned to the variable.

Set_Variable_Lowercase_Value

Evaluate Expression

The Evaluate Expression operation is extremely powerful.  It can evaluate simple arithmetic, such as 1+2/5*10, but it can also work with a variety of internal functions.  In the example below the %STRINGVAR% will be assigned the first 5 characters of the %SBBUILDINFO% variable.  Please note that all string type variables MUST have double quotes around them where they are used in functions.  In the example below this will be expanded to something like Sub('Something or other',1,5) before it is evaluated, and then the %STRINGVAR% will be assigned the first 5 characters, i.e. 'Somet'

Set_Variable_Evaluate_Expression_Function

The example below returns the ShortPath of the $CSIDL_APPDATA$ system variable. 

Set_Variable_Evaluate_Expression_Path_And_String

 

We will be documenting the functions that are available for the Evaluate Expression as we add more to the list.  Please check our Function Reference for more information.

 

You can create some very powerful things with the Set Variable action.  Such as format data to your liking, for example by using Format(Today(),@d17) to format a date to the standard short windows format.  Or retrieve part of a string by using Sub() or Instring(). 

 

You can also use Build Automator variables in your expressions.  The only requirement is that if the variables contain alphanumeric data the variables MUST be enclosed in Double Quotes, such as "$CSIDL_APPDATA$" or "%THISVALUE%"  Numeric variables, or string variables that contain numeric values only do not need to be enclosed in double quotes if they are used as numeric parameters.

 

 



Direct link to this page: http://www.buildautomator.com/onlinemanual/setvariable.htm