Help \ Custom Variables

Actual Installer allows your to write data to Registry (page System \ Registry), and to read data from Registry (data values are saved into custom variables).

On the System \ Variables page you can specify custom variables for using during the installation process. Data are retrieved from the Registry (also can read from INI or any other files, read an Internet file) at the setup beginning (before Prerequisites checking and Commands execution).

Variable

The name of the variable. Must be surrounded by symbols < and >

<MyVar1>

Registry Bitness

The bitness of the Windows Registry. It is recommended to set it to Default.

In this case, access to the Registry depends on the selected option of the required bitness of Operating System (32 or 64-bit) on the General \ Requirements tab. If 64-bit only is selected, the setup will access 64-bit Registry, or 32-bit otherwise. Read more about accessing the 64-bit Registry.

Registry Key

The path to the registry key. Short Root Keys are supported (HKCU=HKEY_CURRENT_USER, HKLM=HKEY_LOCAL_MACHINE). If this field is empty, then Default Data will be assigned to the variable.
Use HKEY_DEFAULT rootkey (short name HKDE) to replace it with HKEY_CURRENT_USER if the installation is for current user; or with HKEY_LOCAL_MACHINE if the installation is for All Users.

To read a value from INI or Any file, type in this field the path to the file.

HKEY_CURRENT_USER\Software\MyAppName
HKCU\Software\MyAppName
HKEY_DEFAULT\Software\<AppName>
<WindowsDir>\file.ini

Registry Value

The name of the registry value. To read Default value leave this field blank.
To read a value from INI file, type in this field the Section name and Key name separated by symbol ;
To read the first line of any file, leave this field blank. To read a custom line from any file, type the line number (the first line is 0).

Version
InstallPath
Settings;Stat

Value Type

The type of the registry value.

STRING
DWORD

Default Data

If the registry key or value (or INI or file) doesn't exist, this data will be assigned to the variable.

Special Functions

If it fails to retrieve the data (eg. Registry key or value does not exist) you can show a warning message to the user or terminate the installation process.

To show a message, in the Default Data field type: MSG(your message)[x]

x - it's a default data that will be assigned to the variable.

To terminate the installation, in the Default Data field type: HALT(your message)



To read data from Internet file (only the first line) into a variable, type GETURL in the Registry Key field, and type URL of the file (e.g. http://www.website.com/file.txt) in the Regsitry Value field.

To download a file (without Downloader.exe) from Internet, type GETFILE in the Registry Key field, and type URL of the file (e.g. http://www.website.com/file.txt) in the Regsitry Value field. The file will be downloaded to <SetupTempDir>\aitempfile.txt . If the download is successful, the variable will contain 1.

Function to extract a directory from a file path: GETDIRX[path]
Case sensitive. Examples:

GETDIRX[C:\Folder\File.exe]		returns C:\Folder
GETDIRX[<SetupExe>] 		returns a directory where the setup file is located


Function to extract a file name of the file path: GETNAMEX[path]
Case sensitive. Examples:

GETNAMEX[C:\Folder\File.exe]		returns File.exe


Function to extract version number (in format X.X.X.X) from a string: GETVERX[text]
Case sensitive. Examples:

GETVERX[v14.1]		returns 14.1.0.0


To get the max version number (as a subkey name) from a registry key, in the Registry Value field type GETMAXREGKEY.
Example:
to get the max version number (v4.0.30319) from the following registry key, use these settings:


Variable Name	<MyVar1> //or any other
Bitness		Default
Registry Key	HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework
Registry Value	GETMAXREGKEY
Value Type	STRING
Default Data	0
Variable <MyVar1> will contain v4.0.30319

To get the max number (as a value name) from a registry key, in the Registry Value field type GETMAXREGVAL.



To ask a user for some information and save it to a variable, in the Registry Key type INPUTBOX, in the Registry Value type your message to the user. Other fields leave empty. Text from the user will be saved into the variable.

To ask a user to select a file, in the Registry Key type SELECTFILE, in the Registry Value type your message to user. Other fields leave empty. Selected file path will be saved into the variable. To ask with options YES/NO use SELECTFILEASK.

To ask a user to select a directory, in the Registry Key type SELECTDIR, in the Registry Value type your message to user. Other fields leave empty. Selected directory path will be saved into the variable. To ask with options YES/NO use SELECTDIRASK.

To increase the required free space for the product installation, name the variable <ExtraDataFileSize> and in the Default Data field type the required additional amount (in bytes). Other fields leave empty.

When using the page "Interface \ Additional Information" it is possible to set default values for the fields: Query Text, Query Custom, and Query Key. Just add the following variables in the System \ Variables page: <QueryText>, <QueryCustom>, <QueryKey>.

To set the setup language using a variable, name the variable <Language> . The specified language file must be included in the setup program (page Interface / Languages).