An often overlooked aspect of creating scripts for custom dialogs is to disregard the reading and writing of data to set up a silent install.
For example, when you run an installation in normal mode, the user interacts with dialogs and enters information such as the installation directory. That information is then used during the installation. During a silent installation, this data has to also be supplied.
For silent installations in script-based projects, you need to create a response file. This is done by running the installation in normal mode with the -r option. You enter data into the dialogs and that data is written to an .iss file. Later when the customer, system administrator or other user runs the installation in silent mode, the .iss file will be used to provide the data in place of a user doing it.
In a custom dialog script, you have to check if the installation is being run silently at the beginning of the script. You have to also check if you are in record mode at the end of the script. These actions are accomplished by using the SilentReadData and SilentWriteData functions.
The following is a screenshot of a custom dialog script. The custom dialog was created by taking the existing CustomerInformation dialog and adding an email field to it.
Custom dialog script for a modified CustomerInformation dialog
The custom dialog has three fields, a Name field, a Company field and an Email field. In the SILENTMODE section at the beginning of the script, these fields are read from the .iss file when the installation is run in silent mode.
In the RECORDMODE section at the end of the script, the values are written to an .iss file when the installation is run with the -r option. This is how the .iss file is created.
Setting up these two sections in a custom dialog script will allow your installations to work properly during a silent installation. If do not do this, the silent install will not work as expected.