Global variables are variables whose values are automatically set when your installation starts. They are used in action script to represent common values that might differ between systems. These variables are all global which means you can use them anywhere in your project.

Tip: The built-in global variables are listed along with all of the actions and constants when you press Ctrl+Space in the action editor. Since all of the built-in variables start with an underscore, if you type _ and then press Ctrl+Space, you'll be taken right to the first built-in global variable in the list.

The following global variables are available in Setup Factory:


The folder that files with the Create backup option enabled will be backed up to at runtime. If not defined, backup files are created in the same folder as the target file. By default, this variable is undefined.

Tip: The best place to define this variable is On Pre Install so that all installation folders are defined:
_BackupFolder = SessionVar.Expand("%AppFolder%\\Backup");


A numerically indexed table that contains the command line arguments passed into the installation executable.


The path to the user's Desktop folder.


The path to the All Users profile Desktop folder.


Whether or not the close button (X) will be disabled on screens. If this boolean variable is set to true the close button will be disabled. If the value is false (by default), it will be enabled. This variable can only be set from a project event such as On Startup. It will then affect any screens displayed after that point.


Whether or not the uninstall is currently being performed. If true is returned, Setup Factory is in the uninstall process. If false is returned, Setup Factory is in the install process. This variable may be useful for Global Functions that you want to use for both the install and uninstall but rely on which stage the setup is in.


A table of Boolean values that control whether certain install stages are executed at runtime. Initially these values are set to true. If you want to skip a future install stage, you can set its table entry to false. The install stage table contains the following indexes that can be set:


Note: These values simply control whether or not the "stage" will be executed. For example, if you did not have an uninstall program set to be created, you cannot enable its actual creation by setting "CreateUninstall". This feature is mainly used for skipping stages.


This variable contains the string "SUF9" when used in Setup Factory. This allows you to identify the product being run from script.  This could be useful when making generic scripts that are used in several products, but that have different things to do based on the product being run from.


Whether or not the system needs to be restarted at the end of the install or uninstall process in order to install/uninstall files that were in use. This variable is initially set to false when the install or uninstall starts and is set to true if the system needs to be restarted.

Note: If the install needs to be rebooted, a dialog prompt will be shown automatically asking whether or not a reboot should proceed. The dialog and reboot action that are automatically added to each project on the On Shutdown event are defined in the function g_HandleSystemReboot() which can be found in the global script file _SUF70_Global_Functions.lua.


The user's Program Files folder (typically, this is something like "C:\Program Files").


The user's Program Files folder on 64-bit operating systems. On 32-bit systems, the value is equal to _ProgramFilesFolder.


Whether or not the install should be run in "silent mode". Initially this value is set to the boolean value false, but if set to true the install will be run silently.

In silent mode, no user interface is presented to the user at all; any screens or dialog messages will not be shown.


Note that although you can change the value of _SilentInstall at any time, you should only switch to or from silent mode on one of the four "main" action tabs:

On Startup

On Pre Install / On Pre Uninstall

On Post Install / On Post Uninstall

On Shutdown

Changing the value of _SilentInstall at any other point will have no effect on any screens or progress displays until the next "main" action tab is reached.

Tip: This variable can also be set using the command line option /S or by selecting the Start in silent mode option at design time.


The drive that the installation executable was run from (e.g. "C:" or "D:").


The full path and filename of the installation executable (e.g. "C:\Downloads\setup.exe").


The full path to the folder that the installation executable was run from (e.g. "C:\Downloads" or "D:\").


Whether or not to check the uninstall configuration file for existing entries when installing archive and external files. By default this variable is undefined, but when set to the boolean value true, duplicate file checking will be skipped when writing out file data to the uninstall configuration file. If the variable is undefined or is false, duplicate file checking will be performed. This variable must be defined before the installing files stage.

Note: This variable is generally only used in very large installs where large amounts of files are being installed. In these cases, it will generally increase the speed of installing the files. However, this also means that there may be duplicate entries in the uninstall configuration file if the user installed over top of an existing setup. In this case, the uninstall will still function correctly, but may need to be addressed if you are manually querying the uninstall configuration file.


The path to the userís Windows System folder (e.g. "C:\Windows\System32").


A table indexed by error codes containing all of the possible error messages. For example, accessing the table index _tblErrorMessages[1000] will access the error code string "The specified file could not be found." The Application.GetLastError action is used to retrieve the last performed action's error code.


The path to the user's Temp folder.


The path to the temporary directory where Setup Factory extracts the files it will need for the installation. (For example, this is the directory where Primer files are extracted to.) During the uninstall, this variable contains the path to the uninstall files folder. This is the folder that the uninstall configuration file is located.

Usually this directory will be the user's temporary directory, unless the user overrides the temporary directory with the /T command line option.


A table of Boolean values that control whether certain uninstall stages are executed at runtime. Initially these values are set to true. If you want to skip a future uninstall stage, you can set its table entry to false. The uninstall stage table contains the following indexes that can be set:


Note: This table can only be modified during the uninstall. Setting them during the install has no effect.


Whether or not shortcuts are created in the per user, or all user profile on XP/Vista or later systems. If this variable contains true, the per user profile will be used and if it contains false, the all user profile will be used. Initially this value is taken from the Default User Profile for Shortcuts setting in the advanced project settings. This value can also be set by the end user at run time on the Select Shortcut Folder screen.


If set to true, Setup Factory will use the system's default character set (script) for text elements on screens when using custom fonts ("Use Custom Fonts" set to True), overriding it's font script setting. This makes the text font behave like Setup Factory's default settings when working with multiple languages. If you wish to use this variable, it's recommended that you set it very early in the setup. This variable defaults to false.


The path to the user's Windows folder (e.g. "C:\Windows").