Predefined and internally defined variables

Inno Setup Preprocessor

Predefined and internally defined variables

There are number of predefined variables in ISPP which basically supported for compatibility with other preprocessors. Predefined variables cannot be undefined or redefined. Some of them have special purpose and their value can vary depending on certain circumstances. Depending on the nature of a predefined varialbe, redefinition (or overriding) of it can produce unpredictable results. It is not recommended to do so.

__COUNTER__ int. Automatically increments each time it is used (afterwards).
__FILE__ str. Returns name of the current file. Empty string for the root file.
__INCLUDE__ str. Returns current include path (or paths delimitted with semicolons) set via #pragma include.
__LINE__ int. Returns number of a line in the current file (not a translation), on which the variable is used (or macro that uses this variable is called).
__OPT_X__ void. Defined if specified option set via #pragma option -x+ is in effect. In place of "X" may be any letter from "A" to "Z." Use Defined function to test whether the variable is defined.
__PATHFILENAME__ str. Similar to __FILE__ but, returns full pathname of the file. Empty string for the root file.
__POPT_X__ void. Defined if specified parser option set via #pragma parseroption -x+ is in effect. In place of "X" may be any letter from "A" to "Z." Use Defined function to test whether the variable is defined.
__WIN32__ void. Always defined.
ISPP_INVOKED void. Always defined.
PREPROCVER int. Returns 32-bit encoded version of ISPP. Highest byte holds major version, lowest byte holds the build number.
WINDOWS void. Always defined.

Internally ISPP defines some special variables. These variables are usual public variables with the only difference that their declaration is handled by ISPP automatically. You can redefine or undefine them.

CompilerPath str. Points to a directory where the compiler is located.
SourcePath str. Points to a directory where the current script is located, or the current directory if the script has not yet been saved.
Ver int. Returns 32-bit encoded version of Inno Setup compiler. Highest byte holds major version, lowest byte usually holds zero.