Functions for working with variables
If you use Source Code command or use external .g files in your project, then sometimes you need to get or set values of variables during the installation process. You can see the list of functions for working with variables and examples of their using below. There are predefined variables variables and folders folders created during the installation. You can call these functions for any variables. You can get and modify values for predefined variables too.
varname - the variable name. For example, "setuppath", "myvar", "oswindows".
function uint macrox_ismacro( str varname )
If the specified variable exists, then the function returns 1. Otherwise, it returns 0.
if macrox_ismacro( "myvar" ) { ... }
function str macrox_get( str varname )
The function returns the value of the varname variable. Inner variables are not substituted. For example, if the value equals '#setuppath#\subfoler' then #setuppath# is not replaced by the current value of the setuppath variable.
str val = macrox_get( "myparam" )
function str macrox_do( str value )
The function replaces #var# variables in the specified string and returns it.
print( macrox_do( "Setup Path: #setuppath# \r\nWindows Path: #winpath#" )) str temp = "#winpath#" macrox_do( temp )
function str macrox_getstr( str varname, str param )
Gets the value of the varname variable and write s it into param. The function returns param.
str myval macrox_getstr( "myparam", myval )
function int macrox_getint( str varname )
Gets the integer value of the varname variable.
int os = macrox_getint( "oswindows" )
function macrox_setstr( str varname, str param )
Sets the string value of the varname variable.param is a new value. If the variable doesn't exist, it is created.
macrox_setstr( "myparam", myval ) macrox_setstr( "myparam", "New value" )
function macrox_setint( str varname, int value )
Sets the integer value of the varname variable. value is a new value. If the variable doesn't exist, it is created.
macrox_setint( "status", 1 )
Also, you can set and modify variables with the Set Variables command.
See also
Eonza automation software - free, open source cross-platform program for easy creation and management of scripts.