Skipping Pages

From NSIS Wiki

To skip a built-in page, use Abort in the pre callback function. To skip a custom page, simply don't call the plug-in that shows the page, or use Abort in custom page function.

To define a pre callback function, use the Page command. For example:

Name skip
OutFile skip.exe
 
InstallDir $TEMP
 
Page license
Page custom customPage
Page components
Page directory dirPre
Page instfiles
 
Section
SectionEnd
 
Function customPage
MessageBox MB_YESNO "Skip custom page?" IDNO noskip
	Abort
noskip:
StartMenu::Select "This is a custom page"
Pop $0
FunctionEnd
 
Function dirPre
MessageBox MB_YESNO "Skip directory page?" IDNO noskip
	Abort
noskip:
FunctionEnd

When using the Modern UI, use the MUI_PAGE_CUSTOMFUNCTION_PRE define. For example:

!include "MUI2.nsh"
 
Name skip
OutFile skip.exe
 
InstallDir $TEMP
 
!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\license.txt"
!insertmacro MUI_PAGE_COMPONENTS
!define MUI_PAGE_CUSTOMFUNCTION_PRE dirPre
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
 
!insertmacro MUI_LANGUAGE "English"
 
Section "Main Section" SECTION1
...
SectionEnd
 
Function dirPre
  ${Unless} ${SectionIsSelected} ${SECTION1}
    Abort
  ${EndUnless}
FunctionEnd
Personal tools
donate
ads