Skipping Pages: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
(skipping a custom page)
No edit summary
 
Line 33: Line 33:
When using the Modern UI, use the MUI_PAGE_CUSTOMFUNCTION_PRE define. For example:
When using the Modern UI, use the MUI_PAGE_CUSTOMFUNCTION_PRE define. For example:
<highlight-nsis>
<highlight-nsis>
!include "MUI.nsh"
!include "MUI2.nsh"


Name skip
Name skip
Line 41: Line 41:


!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\license.txt"
!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\license.txt"
Page custom customPage
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_COMPONENTS
!define MUI_PAGE_CUSTOMFUNCTION_PRE dirPre
!define MUI_PAGE_CUSTOMFUNCTION_PRE dirPre
Line 49: Line 48:
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "English"


Section
Section "Main Section" SECTION1
...
SectionEnd
SectionEnd
Function customPage
MessageBox MB_YESNO "Skip custom page?" IDNO noskip
Abort
noskip:
# StartMenu is used here just for the sake of the example.
# In real installers, use the MUI_PAGE_STARTMENU macro instead.
StartMenu::Select "This is a custom page"
Pop $0
FunctionEnd


Function dirPre
Function dirPre
MessageBox MB_YESNO "Skip directory page?" IDNO noskip
  ${Unless} ${SectionIsSelected} ${SECTION1}
Abort
    Abort
noskip:
  ${EndUnless}
FunctionEnd
FunctionEnd
</highlight-nsis>
</highlight-nsis>


[[Category:Scripting FAQ]]
[[Category:Scripting FAQ]]

Latest revision as of 14:30, 14 July 2009

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