Skipping Pages: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
(should have been here a long time ago...) |
(skipping a custom page) |
||
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 30: | Line 40: | ||
InstallDir $TEMP | InstallDir $TEMP | ||
!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 39: | Line 51: | ||
Section | Section | ||
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 |
Revision as of 22:25, 5 January 2006
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 "MUI.nsh" Name skip OutFile skip.exe InstallDir $TEMP !insertmacro MUI_PAGE_LICENSE "${NSISDIR}\license.txt" Page custom customPage !insertmacro MUI_PAGE_COMPONENTS !define MUI_PAGE_CUSTOMFUNCTION_PRE dirPre !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_LANGUAGE "English" Section 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 MessageBox MB_YESNO "Skip directory page?" IDNO noskip Abort noskip: FunctionEnd