Skip to content
⌘ NSIS Forum Archive

Begginer question

3 posts

ayresp#

Begginer question

Hello guys.

I am entirely new in NSIS world and I am trying to make a installer with some custom pages.

The first custom page I have added is named as "InstallOptionsPage".

The user enters the setup, the "InstallOptionsPage" come up to the user on screen, the user presses next.

The next page is MUI_PAGE_DIRECTORY. Before MUI_PAGE_DIRECTORY is showed, I check the state of a radio box belonged to "InstallOptionsPage". If the radio box is true, I must show
MUI_PAGE_INSTFILES instead of the MUI_PAGE_DIRECTORY.

How do I show a page which is not next to the actual page?

Example:
I am on page 1 and I want to show page 5 if one conditional is satisfied.

Tks.
ramon18#
sample code

!include "MUI.nsh"
name ConditionalPage
OutFile ConditionalPage.exe
var ShowSirectory ;Show the directory page??? if "1" show, if "0" don't show
!define MUI_PAGE_CUSTOMFUNCTION_PRE OnShowDirectory
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
Section "Dummy"
SectionEnd
Function OnShowDirectory
        StrCmp $ShowSirectory "1" ShowPage
        abort
ShowPage:
FunctionEnd
Function .OnInit
        MessageBox MB_ICONQUESTION|MB_YESNO "Show Directory Page?" IDYES 0 IDNO DontShow
        StrCpy $ShowSirectory "1"
        goto TestDone
DontShow:
        StrCpy $ShowSirectory "0"
TestDone:
FunctionEnd 
just change your custom page function to set up one variable that will be checked on the pre_function of MUI_PAGE_DIRECTORY, then call abort to skip that page

hope this helps you
good luck,
Ramon