Question

I am trying NSIS doc example for silent installer, here. Uncommenting the line

; SilentInstall silent

then yes, my installer is silent. However, it displays message boxes. It is expected that message boxes do appear even if installer is silent. To make message boxes silent as well, one has to play with /SD option for each message box. The example script proposes it here:

MessageBox MB_OK|MB_ICONINFORMATION "This is not a silent installer" /SD IDOK

Another mean to make the message box silent is exposed: it checks if silent. If silent, then jump two lines ahead (so do not show message box)

IfSilent 0 +2
    MessageBox MB_OK|MB_ICONINFORMATION 'This is a "silent" installer'

This second solution does not work for me. If i set the installer silent, the box with 'this is a silent installer' does appear. If i change it for

MessageBox MB_OK|MB_ICONINFORMATION 'This is a "silent" installer' /SD IDOK

the message does not appear.

Why is the jump in

IfSilent 0 +2

not working? +3is not making it either.

Was it helpful?

Solution 2

Because the first argument is offset to jump in case of silent installation (the second one for non-silent).

Try this:

IfSilent +2 0

OTHER TIPS

Like zbynour said, you got the parameters mixed up.

To avoid issues with relative jumps, use the logiclib:

!include LogicLib.nsh

...

${IfNot} ${Silent}
  MessageBox ...
${EndIf}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top