Search code examples
installationnsis

How to create a mock installer in NSIS?


I want to make a mock installer using NSIS so we can demo what our final install process will look like when it's done.

I've gone through the wizard using the Eclipse plugin to create a classic installer. I want to add additional screens that have no back-end functionality but that would display a description of the data the user needs to input (such as the path to the JRE), a textbox + browse button to input it, and a next button. How can I do this?


Solution

  • An exact answer will depend on which user interface you're using.

    If you're using the Modern User Interface, this might be of some help:

    !define MUI_DIRECTORYPAGE_VARIABLE $InstallDirectory
    !insertmacro MUI_PAGE_DIRECTORY
    
    !define MUI_DIRECTORYPAGE_VARIABLE $JRE_InstallDirectory
    !define MUI_PAGE_HEADER_TEXT "Choose JRE Location"
    !define MUI_PAGE_HEADER_SUBTEXT "Choose an installation path for the JRE."
    !define MUI_DIRECTORYPAGE_TEXT_TOP "This program will install the JRE to the following directory.  To use a different path, click Browse and select another directory. Click Next to continue."
    !define MUI_DIRECTORYPAGE_TEXT_DESTINATION "JRE Path"
    !insertmacro MUI_PAGE_DIRECTORY
    

    That will display the standard Directory page with all the default text (asking for the installation path of your program) and store it in the $InstallDirectory variable.

    The following page will have the same layout but with custom text to ask for the JRE install directory, which will be stored in the $JRE_InstallDirectory variable. For more information, see the documentation.