5.2 Predefines
You can use these standard predefines to automatically add the build time to the title of development versions, add the date to the version number, etc.
5.2.1 ${COUNTER}
Expands to a number (Starting at 0 and incrementing by 1 every time it is used)
5.2.2 ${FILE}
5.2.3 ${FILEDIR}
5.2.4 ${LINE}
5.2.5 ${DATE}
Date when the script started compiling according to the current locale.
5.2.6 ${TIME}
Time when the script started compiling according to the current locale.
5.2.7 ${TIMESTAMP}
Date & time of the last modification to the script file according to the current locale.
5.2.8 ${NSIS_VERSION}
NSIS version used to build the script.
5.2.9 ${NSIS_PACKEDVERSION}
NSIS version as a 32-bit number.
- !if 0x3014000 >= "${NSIS_PACKEDVERSION}"
- !error "NSIS 3.15 or higher is required to build this installer!"
- !endif
5.2.10 ${NSIS_CHAR_SIZE}
The size of a character code unit (in bytes). 1 in ANSI installers and 2 in Unicode installers.
A grapheme cluster consists of a base character plus optional combining characters and diacritics and is defined as one or more code points. One or more code units is required to encode a single code point.
5.2.11 ${NSIS_PTR_SIZE}
The size of a pointer (in bytes) in the generated installer.
5.2.12 ${U+1}…${U+10FFFF}
A Unicode (UCS-4) character.
- DetailPrint "${U+2115}SIS" # DOUBLE-STRUCK CAPITAL N + "SIS"
5.2.13 Scope Predefines
Standard predefines that contain information about the current code scope.
5.2.13.1 ${GLOBAL}
Defined in the global scope.
- Section test
- !ifdef ${__GLOBAL__}
- !error "this shouldn't be here!"
- !endif
- SectionEnd
- PageEx instfiles
- !ifdef ${__GLOBAL__}
- !error "this shouldn't be here!"
- !endif
- PageExEnd
5.2.13.2 ${SECTION}
Defined as the section name, without any prefixes, in section scope.
- !ifdef __SECTION__
- !error "this shouldn't be here!"
- !endif
- Section test
- !ifndef __SECTION__
- !error "missing predefine!"
- !endif
- !if ${__SECTION__} != test
- !error "wrong predefine value!"
- !endif
- SectionEnd
- Section !test
- !if ${__SECTION__} != test
- !error "wrong predefine value!"
- !endif
- SectionEnd
- Section un.test
- !if ${__SECTION__} != test
- !error "wrong predefine value!"
- !endif
- SectionEnd
5.2.13.3 ${FUNCTION}
Defined as the function name, without any prefixes, in function scope.
- !ifdef __FUNCTION__
- !error "this shouldn't be here!"
- !endif
- Function test
- !ifndef __FUNCTION__
- !error "missing predefine!"
- !endif
- !if ${__FUNCTION__} != test
- !error "wrong predefine value!"
- !endif
- FunctionEnd
- Function un.test
- !if ${__FUNCTION__} != test
- !error "wrong predefine value!"
- !endif
- FunctionEnd
5.2.13.4 ${PAGEEX}
Defined as the page type in PageEx scope.
- !ifdef __PAGEEX__
- !error "this shouldn't be here!"
- !endif
- PageEx instfiles
- !ifndef __PAGEEX__
- !error "missing predefine!"
- !endif
- !if ${__PAGEEX__} != instfiles
- !error "wrong page type"
- !endif
- PageExEnd
5.2.13.5 ${UNINSTALL}
Defined in section, function or PageEx scopes of the uninstaller.
- !ifdef __UNINSTALL__
- !error "this shouldn't be here!"
- !endif
- Function test
- !ifdef __UNINSTALL__
- !error "this shouldn't be here!"
- !endif
- FunctionEnd
- Function un.test
- !ifndef __UNINSTALL__
- !error "missing predefine!"
- !endif
- FunctionEnd