Previous | Contents | Next

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 ${__FILE__}

Current script name.

5.2.2 ${__LINE__}

Current line number.

5.2.3 ${__DATE__}

Date when the script started compiling according to the current locale.

5.2.4 ${__TIME__}

Time when the script started compiling according to the current locale.

5.2.5 ${__TIMESTAMP__}

Date & time of the last modification to the script file according to the current locale.

5.2.6 ${NSIS_VERSION}

NSIS version used to build the script.

5.2.7 Scope Predefines

Standard predefines that contain information of the current code scope.

5.2.7.1 ${__GLOBAL__}

Defined in the global scope.

Section test

  !ifdef ${__GLOBAL__}
    !error "this shouldn't be here!"
  !endif

SectionEnd

Function test

  !ifdef ${__GLOBAL__}
    !error "this shouldn't be here!"
  !endif

FunctionEnd

PageEx instfiles

  !ifdef ${__GLOBAL__}
    !error "this shouldn't be here!"
  !endif

PageExEnd

5.2.7.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.7.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.7.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.7.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

Previous | Contents | Next