nsis
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
nsis [2014/12/09 12:46] – skipidar | nsis [2020/12/27 20:35] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ===== NSIS Installer ===== | ||
+ | http:// | ||
+ | An old installer. | ||
+ | Use Inno Setup if possible: | ||
+ | |||
+ | http:// | ||
+ | http:// | ||
+ | |||
+ | |||
+ | === Command Line parameters | ||
+ | |||
+ | Read command line parameters | ||
+ | < | ||
+ | ${GetOptions} " | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | " | ||
+ | ; | ||
+ | " | ||
+ | ; | ||
+ | $var ; Result: option string | ||
+ | </ | ||
+ | |||
+ | |||
+ | **Example** | ||
+ | < | ||
+ | Section | ||
+ | ${GetOptions} " | ||
+ | ; | ||
+ | SectionEnd | ||
+ | </ | ||
+ | |||
+ | |||
+ | === Multiple Files via include === | ||
+ | merge multiple files via **include** | ||
+ | |||
+ | This command will include ' | ||
+ | |||
+ | |||
+ | |||
+ | < | ||
+ | !include WinMessages.nsh | ||
+ | !include Library.nsh | ||
+ | !include C: | ||
+ | !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. | ||
+ | |||
+ | |||
+ | === Variables === | ||
+ | |||
+ | 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 " | ||
+ | StrCpy $example2 " | ||
+ | FunctionEnd | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ==== Sections ==== | ||
+ | |||
+ | 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 " | ||
+ | SectionEnd | ||
+ | |||
+ | Section Tariff SEC0001 | ||
+ | SetOutPath $INSTDIR | ||
+ | SetOverwrite on | ||
+ | File " | ||
+ | SectionEnd | ||
+ | |||
+ | Section | ||
+ | SetOutPath $INSTDIR | ||
+ | SetOverwrite on | ||
+ | File " | ||
+ | SectionEnd | ||
+ | |||
+ | Function .onSelChange | ||
+ | MessageBox MB_OK " | ||
+ | FunctionEnd | ||
+ | </ | ||
+ | |||
+ | Rendered as checkboxes: | ||
+ | |||
+ | {{http:// | ||
+ | |||
+ | you may implement callbacks which are triggered when the seleciton is changed. | ||
+ | |||
+ | < | ||
+ | Function .onSelChange | ||
+ | MessageBox MB_OK " | ||
+ | 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: | ||
+ | | ||
+ | FunctionEnd | ||
+ | </ |