Skipping Pages: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
(should have been here a long time ago...)
 
No edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
To skip a page, use Abort in the pre callback function.
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:
To define a pre callback function, use the Page command. For example:
Line 8: Line 8:
InstallDir $TEMP
InstallDir $TEMP


Page license
Page custom customPage
Page components
Page components
Page directory dirPre
Page directory dirPre
Line 14: Line 16:
Section
Section
SectionEnd
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
Function dirPre
Line 23: 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 30: Line 40:
InstallDir $TEMP
InstallDir $TEMP


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


Section
Section "Main Section" SECTION1
...
SectionEnd
SectionEnd


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