Skip to content
⌘ NSIS Forum Archive

Syntax in a NSIS script file

2 posts

tapsklaps#

Syntax in a NSIS script file

Due to usage of the NSIS Logic Library (implemented by the command
"!include LogicLib.nsh" in the *.nsi sript file) I often encountered constructs, which contain the 3 characters "$", "{" and "}".

Typical examples are:
  • ${If}
  • ${EndIf}
  • ${FileExists}
  • ${WordReplace}
  • ${SetEnvironmentVariable}
  • ${SegmentOnit}
  • ${SegmentPrePrimary}


But in which cases is it necessary to use these characters and why I can omit these characters in connection with the following instructions:
  • CopyFiles
  • WriteINIStr
Anders#
It just means insert the content of a define
!define xyz "OhCrap"
!error ${xyz}
A common way to create helper functions is
!define MyFunc "!insertmacro MyFuncImplementation"
!macro MyFuncImplementation
DetailPrint "Performing myfunc"
Exec '"myfunc.exe" /w00t'
!macroend
..and call it with ${MyFunc}. Other functions like CopyFiles are native functions that makensis.exe knows about and they are documented in the main helpfile...