Variables Overview



Variables in FinalBuilder are the key to making your builds dynamic. Variables can be used in almost every text property of every FinalBuilder action, for example in fields that specify file paths, directories etc.


There are 5 types of variables available:


Local variables are defined on Action Groups, and only available to child actions.


Project variables are defined and managed by you, and are specific to this project.


User variables are defined and managed by you, and are global across all projects, but are specific to one Windows user.
Application variables are defined by FinalBuilder, to give you useful information about the context of the project.
Environment variables simply provide access to Windows environment variables such as PATH and OS. The range of environment variables available depends on your installation of Windows and other software.


System and Environment variables cannot be edited in any way from FinalBuilder.


Variables can be modified at run time by using actions (such as the Set Variable Action), or from Active Scripting events. Some actions allow you to set a variable to reflect the action's output. Action output can also be logged to a variable.


Variables defined in FinalBuilder can be referenced in FinalBuilder VBScript and JavaScript in the same way as normal script variables. In PowerShell, variables can be referenced by using the following syntax: $FBVariables.GetVariable(<variablename>)/$FBVariables.SetVariable(<variablename>).   Only Project and User variables can be modified.


Variables Editor


To create or edit existing variables, use the Variables Editor. You can launch the Variables Editor from the Project menu by selecting Edit Variables, with the keyboard short cut <Shift+F2>, or by double clicking on the Variables node of the Project Tree.





In addition to the four categories of variables, there are three flags that can be set on each variable.



Make Env.

Project and User Variables can be made available as environment variables to applications that are executed by FinalBuilder.  That is, if you create a variable MYVAR and set the "Make Env." flag, a command shell action could access it as %MYVAR%.



Is Macro

The Is Macro flag forces FinalBuilder to re-evaluate the variable by expanding the Default Value, whenever that variable is referenced during the build. This is particularly useful for variables that are used in scripting: whereas most actions automatically expand all variable references, regardless of the "Is Macro" flag, this does not happen in script events. If you set this flag, however, any contained variable references are automatically expanded.


For example, you can make a "Buildpath" macro variable that contains "%BuildHome%\%ProductName%\%BuildName%". Each time it is accessed, whether from script or an action, it will expand to the current value of those variables.


Macro Variables cannot be set during the build using the Set Variable action or any other means.




The values of persistent variables are stored automatically between executions of the FinalBuilder project. Persistent variables are saved regardless of whether or not the project is saved.


Persistent variable values are stored in .fbpinf files. Each fbpinf file has the same name as the FinalBuilder project (to persist variables, FinalBuilder needs write access to the directory containing the project and the ability to create or write to the .fbpinf file.)





Variables can be organised into variable groups to assist with managing your project. The grouping has no effect on variable scope or behaviour at runtime.

To create a group, simply edit a variable and change its "Group" property to some new name.
To remove a variable from a group, edit it and set the group to blank.
Use dots to create nested groups:


In the following example, variable "ObjName" is in the group "BuildVars.Debug".





See Also


Using Variables

Project Variables

User Variables

Environment Variables

Application Variables

Action List Parameters

Escaping Variable References