Skip to content
⌘ NSIS Forum Archive

conditional !define

3 posts

dans#

conditional !define

I apologize, but this is a pretty basic question.
I was trying to use !define to have conditional actions in the install/uninstall process until I released jumping over the !define lines wasn't really skipping them. How can I have this functionality in NSIS? I basically want to set a "flag" in the onInit function and know about it or the lack of it in the main section.

Thanks in advance!
Comperio#
Sounds like you may be confusing compile time with run time.

Compile time instructions begin with a "!" symbol and get processed once while your setup is compiling. Compile time conditionals include !if, !ifdef,and !ifmacrodef. The !define command is also a compile-time command

Run-time conditionals are processed at runtime (when the user is actually running the installation).

Based on your explanation, I'd say you are likely looking for a run-time conditional.

LogicLib, can make run-time decisions easy. Let's say you use use the variable $Flag to control. You might use something like this:

${If} $Flag == "1"
; do something here for flag value 1
${Else}
; do something here for other flag values
${EndIf}