http://nsis.sourceforge.net/Main_Page
An old installer. Use Inno Setup if possible:
http://jrsoftware.org/isinfo.php
http://sourceforge.net/projects/istool/
Read command line parameters
${GetOptions} "[Parameters]" "[Option]" $var
"[Parameters]" ; command line parameters ; "[Option]" ; option name ; $var ; Result: option string
Example
Section ${GetOptions} "-INSTDIR=C:\Program Files\Common Files -SILENT=yes" "-INSTDIR=" $R0 ;$R0=C:\Program Files\Common Files SectionEnd
merge multiple files via include
This command will include 'file' as if it was part of the original script. Note that if a file is included in another directory, the current directory is still where the script was compiled from (not where the included file resides). If the compiler can't find the file it will look for it in every include directory. See !addincludedir for more information. If the /nonfatal switch is used and no files are found, a warning will be issued instead of an error.
!include WinMessages.nsh !include Library.nsh !include C:\MyConfig.nsi !include ..\MyConfig.nsh !include /NONFATAL file_that_may_exist_or_not.nsh
Use !addincludedir to point to a folder where some NSIS Scripts may be found for inclusion.
The $ is prepended to the variables: $varName
Variables are defined once.
Then they are overridden via StrCopy
Example
Var example Function testVar Var /GLOBAL example2 StrCpy $example "example value" StrCpy $example2 "another example value" FunctionEnd
The script is devided in sections. Each section matches a logical unit - a logical unit. E.g. a decision, a set of commands etc.
# Installer sections Section /o Sales SEC0000 SetOutPath $INSTDIR SetOverwrite on File "componentDummyFiles\sales.txt" SectionEnd Section Tariff SEC0001 SetOutPath $INSTDIR SetOverwrite on File "componentDummyFiles\tariff.txt" SectionEnd Section /o Customer SEC0002 SetOutPath $INSTDIR SetOverwrite on File "componentDummyFiles\customer.txt" SectionEnd Function .onSelChange MessageBox MB_OK "onSelChange" FunctionEnd
Rendered as checkboxes:
you may implement callbacks which are triggered when the seleciton is changed.
Function .onSelChange MessageBox MB_OK "onSelChange" FunctionEnd
you may change the state of checkboxes programmatically:
; executed on initialization of wizard Function .onInit IfSilent 0 silentCodeEnd ; executed in silent mode only !insertmacro SetSectionFlag ${SEC0000} ${SF_SELECTED} !insertmacro SetSectionFlag ${SEC0001} ${SF_SELECTED} !insertmacro SetSectionFlag ${SEC0002} ${SF_SELECTED} silentCodeEnd: ; silent block ENDS here FunctionEnd