Archive: how to display conditionally a custom page


how to display conditionally a custom page
  How can I display a custom page during setup depending on a variable ?
I have a variable, which if it is true allow me to display a custom page before going on with my setup and if it is false I just want to continue without displaying my custom page.

Thx


hello,
have a look at InstallOptions.nsi in your "NSIS\Examples\Modern UI" folder. there are a few custom pages.
for example you have for the second page


CustomPageB

!insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "ioB.ini"
>FunctionEnd
>
if you add one line, a comparation, it will not be displayed all the time, depending on your selection. the line is already used for displayng a message box if the section was selected. try it.

CustomPageB

!insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"
StrCmp $INI_VALUE "1" "" +2
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "ioB.ini"
>FunctionEnd
>
have a look at StrCmp in NSIS manual.
hope it helps.

Just jump over the InstallOptions plugin call.

-Stu


outfile 'test.exe'

page license '' '' licleave
page custom custompre
page directory

section -

sectionend

function custompre
strcmp $R0 'skip' +1 +2
abort
push $0
InstallOptions::initDialog /NOUNLOAD '$PLUGINSDIR\custom.ini'
Pop $0
InstallOptions::show
Pop $0
functionend

function licleave
strcpy $R0 "skip"
functionend

function .onInit
initpluginsdir
file /oname=$PLUGINSDIR\custom.ini "custom.ini"
functionend

thx a lot I got it now !