NSIS Home > NSIS Discussion Forum > NSIS Archive > NSIS Programmer's Reference
  NSIS Programmer's Reference

  Page Instruction

Adds an installer page to the installer.


Syntax

Page (pagetype [pre_function] [show_function] [leave_function]) | (custom custom_function [caption]) [define_if_last]

The Page instruction syntax has these parts:

Part Description
pagetype Constant. Specifies of the type of page you want to insert. You can use one of the following:
license Displays a license page.
components Displays a component selection page.
directory Displays an installation directory selection page.
instfiles Displays an installation progress page.
pre_function Functionname. The specified function will be called just before the page is created.
show_function Functionname. The specified function will be called just after the page is created, but just before the page is shown.
leave_function Functionname. The specified function will be called just after the user pressed the 'Next >' button, but before the page is left.
custom Switch. If this is specified, custom_function is called when this page should be shown.
caption Text. You can specify a caption for the page here. If you want to use the default caption, specify a zero-length string (e.g. "").
define_if_last Undefined symbol. The specified symbol will be defined when this page is the last page before any installation progress (instfiles) page.

Notes

The default order that is used when no Page instructions are used is: license, components, directory and then instfiles.

You can use the function specified at show_function to tweak the user interface.

You can use the Abort instruction from the pre_function function to skip the page, and you can use the Abort instruction from the leave_function function to abort leaving the page, thus stay in the page.

You should use the function custom_function to load the custom page using the InstallOptions.dll, like this:

Page custom customPage ": custom page"

Function customPage
  GetTempFileName $R0
  File /oname=$R0 customPage.ini
  InstallOptions::dialog $R0
  Pop $R1
  StrCmp $R1 "cancel" done
  StrCmp $R1 "back" done
  StrCmp $R1 "success" done
  error: MessageBox MB_OK|MB_ICONSTOP "InstallOptions error:$\r$\n$R1"
  done:
FunctionEnd

Remarks

You can specify a page more than once, just make sure that you know what you are doing.

You must still use the LicenseText and LicenseData instructions for a license (license) page to show. You must also use the ComponentText instruction for a component selection (components) page and the DirText instruction for a directory selection (directory) page to show.

The Page instruction may only be used outside a function, section or macro.


Examples

The following example demonstrates the use of the Page instruction:

Page license
Page component
Page directory
Page instfiles

See Also

UninstPage, LicenseText, LicenseData, ComponentText, DirText and InstallOptions.dll Reference.