The script controls the page order, appearance, and behavior. You can skip pages, paint them white, force the user to stay in a certain page until a certain condition is met, show a readme page, show custom designed pages for input and more. In this section you will learn how to do all of the above.

    There are two basic commands regarding pages, and UninstPage. The first adds a page to the installer, the second adds a page to the uninstaller. On top of those two there is the command which allows you to add a page to either one and with greater amount of options. PageEx allows you to set options to the specific page you are adding instead of using the default that's set outside of .

    The page order is set simply by the order , UninstPage and appear in the script. For example:

    This code will tell NSIS to first show the license page, then the components selection page, then the directory selection page and finally the install log where sections are executed. The uninstaller will first show the uninstall confirmation page and then the uninstallation log.

    You can specify the same page type more than once.

    For backwards compatibility with old NSIS scripts, the following installer pages will be added if no installer page commands are used: license (if LicenseText and were specified), components (if ComponentText was specified and there is more than one visible section), directory (if was specified) and instfiles. When there are no uninstaller page commands the following uninstaller pages will be added: uninstall confirmation page (if UninstallText was specified) and instfiles. This method is deprecated, converting scripts to use page commands is highly recommended because you can use the new standard language strings.

    4.5.2 Page Options

    Each page has its unique set of data that defines how it will look and act. This section describes what data each type of page uses and how you can set it. are described below and are not dealt with in this section.

    The list below lists the commands that affect a certain page type. Unless otherwise mentioned, these commands can be used both inside and outside of a PageEx block. If used inside a block they will only affect the current page being set by PageEx, otherwise they will set the default for all other pages.

    License page

    Directory selection page

    Un/Installation log page

    Uninstall confirmation page

    Use to set the page caption.

    Each built-in page has three callback functions: the pre-function, the show function and the leave-function. The pre-function is called right before the page is created, the show-function is called right after it has been created but before it is shown and the leave-function is called right after the user has pressed the next button (before actually leaving the page).

    • The pre-function allows you to skip the page using .
    • The show-function allows you to tweak the page's user interface with CreateFont, , SendMessage etc.
    • The leave-function allows you to force the user to stay on the current page using .

    A custom page only has two callback functions, one that creates it which is mandatory, and one leave-function that acts just like the leave-function for built-in pages.

    Examples:

    1. Page custom customPage "" ": custom page"
    2. Page instfiles
    3.  
    4. Function skipLicense
    5. MessageBox MB_YESNO "Do you want to skip the license page?" IDNO no
    6. Abort
    7. no:
    8. FunctionEnd
    9.  
    10. Function stayInLicense
    11. MessageBox MB_YESNO "Do you want to stay in the license page?" IDNO no
    12. Abort
    13. no:
    14. FunctionEnd
    15.  
    16. Function customPage
    17. GetTempFileName $R0
    18. File /oname=$R0 customPage.ini
    19. InstallOptions::dialog $R0
    20. Pop $R1
    21. StrCmp $R1 "cancel" done
    22. StrCmp $R1 "back" done
    23. error: MessageBox MB_OK|MB_ICONSTOP "InstallOptions error:$\r$\n$R1"
    24. done:
    25. FunctionEnd

    4.5.4 Page

    Adds an installer page. See the above sections for more information about built-in versus custom pages and about callback functions.

    • license - license page
    • components - components selection page
    • directory - installation directory selection page
    • instfiles - installation page where the sections are executed
    • uninstConfirm - uninstall confirmation page

    The last page of the installer has its cancel button disabled to prevent confusion. To enable it anyway, use /ENABLECANCEL.

    1. custom [creator_function] [leave_function] [caption] [/ENABLECANCEL]
    2. OR
    3. internal_page_type [pre_function] [show_function] [leave_function] [/ENABLECANCEL]

    Adds an uninstaller page. See the above sections for more information about built-in versus custom pages and about callback functions.

    See for possible values of internal_page_type.

    4.5.6 PageEx

    Adds an installer page or an uninstaller page if the un. prefix was used. Every PageEx must have a matching PageExEnd. In a PageEx block you can set options that are specific to this page and will not be used for other pages. Options that are not set will revert to what was set outside the PageEx block or the default if nothing was set. To set the sub-caption for a page use or SubCaption to set the default. To set the callback functions for a page set with PageEx use . See the above sections for more information about built-in versus custom pages.

    Example usage:

    1. PageEx license
    2. LicenseText "Readme"
    3. LicenseData readme.rtf
    4. PageExEnd
    5.  
    6. PageEx license
    7. LicenseData license.txt
    8. LicenseForceSelection checkbox
    9. PageExEnd

    Ends a block.

    4.5.8 PageCallbacks

    Sets the callback functions for a page defined using PageEx. Can only be used inside a block. See the above sections for more information about callback functions.

    1. PageEx license
    2. PageCallbacks licensePre licenseShow licenseLeave