InstallOptionsEx is a NSIS plugin which allows you to create custom pages for
NSIS installers, to prompt the user for extra information. This is a expanded
version of original InstallOptions, with additional controls, flags and options.
InstallOptionsEx will create a dialog which will be displayed inside the NSIS
window. The controls on the dialog can be defined in an INI file.
NSIS 2 has a page system which allows you to add custom pages to your
installer without messing with Prev/Next functions. With the this plugin system,
you also don't have to worry anymore about extracting and deleting the DLL file.
When you store the INI files in the plugins directory, NSIS will also delete them
automatically.
This version of InstallOptionsEx has been designed for NSIS 2. It supports
customized user interfaces and custom font and DPI settings.
This documentation uses the expand/collapse effect, making information to
be in levels. Click on one item name which have an icon to see its respective
description.
This is where everything about the INI file is explained. Changes to the INI
file structure since InstallOptions are represented by these colors:
Specifies the control type. One of the following can be used to determine
a control type:
Label
Used to display static text.
Supported by: InstallOptions 1.0, InstallOptionsEx 2.41 beta 1
Text
Accepts text input from the user.
Supported by: InstallOptions 1.0, InstallOptionsEx 2.41 beta 1
Password
Accepts password input from the user. The input is masked with * characters.
Supported by: InstallOptions 1.0, InstallOptionsEx 2.41 beta 1
IPAddress
Displays an edit box used for IP address input.
Supported by: InstallOptionsEx 2.41 beta 2
HotKey
Removed due to problems internally with the dll.
For InstallOptions 2.41 beta 11 and below:
Displays an edit box used to get keyboard input.
Supported by: InstallOptionsEx 2.41 beta 1-11
UpDown
Displays a pair of arrow buttons that the user can click to increment
or decrement a number in a Text or ComboBox buddy controls,
to change the selection upwards or downwards of a ListBox control,
or to be used alone (without the user knowing what number he/she selected).
Supported by: InstallOptionsEx 2.41 beta 4
ComboBox
Allows the user to select a item in the pop up list and to type text not in there.
Supported by: InstallOptions 1.0, InstallOptionsEx 2.41 beta 1
DropList
Only allows selection of items in the list.
Supported by: InstallOptions 1.0, InstallOptionsEx 2.41 beta 1
ListBox
Shows multiple items and can optionally allow the user to select more than one item.
Supported by: InstallOptions 1.4, InstallOptionsEx 2.41 beta 1
CheckBox
Displays a check box with label.
Supported by: InstallOptions 1.3, InstallOptionsEx 2.41 beta 1
RadioButton
Displays a radio button with label.
Supported by: InstallOptions 1.3, InstallOptionsEx 2.41 beta 1
FileRequest
Use Text and Button controls instead.
For InstallOptionsEx 2.41 beta 4 and below:
Displays a textbox and a browse button. Clicking the browse button will
display a file requester where the user can browse for a file.
Supported by: InstallOptions 1.2, InstallOptionsEx 2.41 beta 1-4 only
DirRequest
Use Text and Button controls instead.
For InstallOptionsEx 2.41 beta 4 and below:
Displays a textbox and a browse button. Clicking the browse button will
display a directory requester where the user can browse for a directory.
Supported by: InstallOptions 1.2, InstallOptionsEx 2.41 beta 1-4 only
Icon
Displays an icon (.ico), an executable icon (.exe), a DLL icon (.dll),
a cursor (.cur), an animated cursor (.ani) or a Windows icon. Any icons (except from executables and
dlls) and cursors (except animated) are resized to fit on the area you gave for the icon, using the
best icon or cursor for that area size. If the area is the same size as the icon or cursor, no
resizing is needed, and it will appear as it is. The plugin will always try to use the best icon or
cursor for your computer display.
For InstallOptions and InstallOptions 2.41 beta 11:
Displays only an icon (.ico), an executable icon (.exe), a DLL icon (.dll) or
a Windows icon.
For InstallOptions and InstallOptions 2.41 beta 10 and below:
Displays only an icon (.ico).
Supported by: InstallOptions 1.4 beta, InstallOptionsEx 2.41 beta 1
Bitmap
Displays a bitmap (.bmp).
Supported by: InstallOptions 1.4 beta, InstallOptionsEx 2.41 beta 1
Animation
Displays an AVI video (.avi). It has to be without sound.
Supported by: InstallOptionsEx 2.41 beta 1
ProgressBar
Displays a bar that shows progress.
Supported by: InstallOptionsEx 2.41 beta 1
TrackBar
Displays a bar where the user can select with the slider one of the
options indicated by ticks. It doesn't include labels.
Supported by: InstallOptionsEx 2.41 beta 2
DateTime
Displays a combobox where the user can pick or select a date or time
he/she wants.
Supported by: InstallOptionsEx 2.41 beta 3
MonthCalendar
Displays a month calendar where the user can select a date he/she wants.
Supported by: InstallOptionsEx 2.41 beta 3
GroupBox
Displays a frame to group controls.
Supported by: InstallOptions 1.0, InstallOptionsEx 2.41 beta 1
Link
Displays a static hot text. State value name determines
if ShellExecute should be used instead of the validation function
return from a notification to run programs, open folders or URLs (e.g.
http://...).
Supported by: InstallOptions 2.2, InstallOptionsEx 2.41 beta 1
Button
Displays a push button that can be used in the same way as the
"Link" control above.
Supported by: InstallOptions 2.3, InstallOptionsEx 2.41 beta 1
Default Value: None
Supported by: InstallOptions 1.0, InstallOptionsEx 2.41 beta 1
Text
Generally specifies control caption, but this can depend on the control type:
Label
Specifies the control caption.
Default Value: None
Supported by: InstallOptions 1.0, InstallOptionsEx 2.41 beta 1
Text/Password
Specifies the password mask character. The control state is imediately
hidden by the character specified.
Default Value: *
Supported by: InstallOptionsEx 2.41 beta 10
UpDown
Specifies the buddy control field number (where the UpDown attaches
itself into another). Recommended types of buddy controls are: Text,
ComboBox and ListBox. If you don't want to have a buddy
control, you have to leave this as blank.
Default Value: None
Supported by: InstallOptionsEx 2.41 beta 4
ComboBox
Removed due to problems internally with the dll.
For InstallOptions 2.41 beta 11 and below:
Specifies the path to a bitmap (.bmp) to load containing a slot for each
item in the list specified by "ListItems". Each bitmap slot (for each list
item) is 16x16 pixels long, with transparent color set to #FF00FF (format
#RRGGBB). Limit of 256 bitmap slots for now. The slots have to be ordered
as the list items.
Default Value: None
Supported by: InstallOptionsEx 2.41 beta 1-11
CheckBox/RadioButton
Specifies the control caption.
Default Value: None
Supported by: InstallOptions 1.3, InstallOptionsEx 2.41 beta 1
Icon
Specifies the path to an icon file (.ico), a cursor (.cur), an animated
cursor (.ani), an executable (.exe) or a plugin (.dll) where the icon can be
found.
For InstallOptions 2.41 beta 11 only:
Specifies the path to an icon file (.ico), an executable (.exe)
or a plugin (.dll) where the icon can be found.
For InstallOptions and InstallOptions 2.41 beta 10 and below:
Specifies the path to an icon file (.ico) where the icon can
be found.
Default Value: None
Supported by: InstallOptions 1.4 beta, InstallOptionsEx 2.41 beta 1
Bitmap
Specifies the path to a bitmap (.bmp).
Default Value: None
Supported by: InstallOptions 1.4 beta, InstallOptionsEx 2.41 beta 1
Animation
Specifies the path to an AVI video (.avi). It has to be without sound.
Default Value: None
Supported by: InstallOptionsEx 2.41 beta 1
DateTime
Specifies the format to show State. The format basic explanation
can be found on the Regional and Language Options on
Control Panel.
Default Value: Date format
specified by the user in the Regional and Language Options from
Control Panel.
Supported by: InstallOptionsEx 2.41 beta 3
Button
Specifies control's text. If ICON or BITMAP flags are
associated with a button control, this specifies the path where the icon or
bitmap is.
For InstallOptions and InstallOptionsEx 2.41 beta 1 only:
Specifies control's text only.
Default Value: None
Supported by: InstallOptions 2.3, InstallOptionsEx 2.41 beta 1
Supported by: InstallOptions 1.0, InstallOptionsEx 2.41 beta 1
State
Causes validation on the selected control to force the user to enter a
minimum amount of text. If the user specifies less text than this, a message
box will appear and the dialog will not be dismissed. This can change
depending on control type:
Text/ComboBox
Specifies the minimum length of text. Maximum is 32768. If 0, means that there
is no minimum limit.
Default Value: 0 (No minimum limit).
Supported by: InstallOptions 1.2, InstallOptionsEx 2.41 beta 1
Animation
Specifies the starting frame of the animation. If 0, it is the first
frame of the animation. If -1, it is the last
frame of the animation and makes it not to be played.
Default Value: 0 (First frame of the animation).
Supported by: InstallOptionsEx 2.41 beta 1
ProgressBar
Removed due to stupidity.
For InstallOptions 2.41 beta 11 and below:
Specifies where the progress starts. Maximum is 65535. If 0, means that there
is no minimum limit.
Default Value: 0 (No minimum limit).
Supported by: InstallOptionsEx 2.41 beta 1
TrackBar
Removed due to stupidity. However, this may return in the future.
For InstallOptions 2.41 beta 11 and below:
Specifies the first item of the control. If 0, means that there
is no minimum limit.
Default Value: 0 (No minimum limit).
Supported by: InstallOptionsEx 2.41 beta 1
Supported by: InstallOptions 1.2, InstallOptionsEx 2.41 beta 1
ValidateText
Removed due to the new Notification System.
For InstallOptions 2.41 beta 5:
Supported by all controls except Label, Bitmap, Icon, GroupBox controls.
Causes InstallOptionsEx to call your NSIS custom page validation/leave
function whenever the control's selection changes. Your validation/leave
function can read the "State" value from the "Settings" section to
determine which control caused the notification, if any, and perform
some appropriate action followed by an Abort instruction (to tell NSIS
to return to the page).
For InstallOptions 2.41 beta 4:
Supported by all controls except Label, Bitmap, Icon, GroupBox, MonthCalendar, DateTime, HotKey and UpDown controls.
For InstallOptions 2.41 beta 3 and below:
Supported by Text, Password, IPAddress, ComboBox, DropList, ListBox, CheckBox, RadioButton, Link and Button controls.
For InstallOptions 2.41 beta 1:
Supported by Text, Password, ComboBox, DropList, ListBox, CheckBox, RadioButton, Link and Button controls.
For InstallOptions 2.41 and below:
Supported by DropList, ListBox, CheckBox, RadioButton, Link and Button controls.
For InstallOptions 2.3:
Supported by CheckBox, RadioButton, Button controls.
Supported by: InstallOptions 2.3, InstallOptionsEx 2.41 beta 1
DISABLED
ONLY_NUMBERS
Forces the user to enter only numbers into the edit box. Doesn't allow
negative numbers to be entered. Text can still be pasted normally.
Supported by: InstallOptions 1.2, InstallOptionsEx 2.41 beta 1
MULTILINE
Causes the control to accept multiple-lines.
Supported by: InstallOptions 2.2, InstallOptionsEx 2.41 beta 1
WANTRETURN
Specifies that a carriage return be inserted when the user presses the
ENTER key while entering text into the text box.
Required flags: MULTILINE.
Supported by: InstallOptions 2.2, InstallOptionsEx 2.41 beta 1
WANTRETURN
Disables the word-wrap that occurs when long lines are entered. Long
lines instead scroll off to the side.
Required flags: MULTILINE.
Disabled by flags: HSCROLL.
Supported by: InstallOptions 2.2, InstallOptionsEx 2.41 beta 1
HSCROLL
Shows a horizontal scroll bar.
Supported by: InstallOptions 1.2, InstallOptionsEx 2.41 beta 1
VSCROLL
Shows a vertical scroll bar.
Supported by: InstallOptions 1.2, InstallOptionsEx 2.41 beta 1
READONLY
Prevents the user from entering or editing text in the edit control,
but allow the user to select and copy the text.
Supported by: InstallOptions 2.2, InstallOptionsEx 2.41 beta 1
PASSWORD
Same as using the control Password.
Supported by: InstallOptions 1.2, InstallOptionsEx 2.41 beta 1
UpDown
LEFT
Makes the control to position to the left of its buddy control.
Supported by: InstallOptionsEx 2.41 beta 4
HSCROLL
Makes the arrows of the control to point left and right instead of up
and down.
Supported by: InstallOptionsEx 2.41 beta 11
HORIZONTAL
Renamed to HSCROLL.
For InstallOptionsEx 2.41 beta 9 and below:
Makes the arrows of the control to point left and right instead of up
and down.
Supported by: InstallOptionsEx 2.41 beta 4
WRAP
Makes the position to "wrap" if it is incremented or decremented beyond
the ending or beginning of the range.
Supported by: InstallOptionsEx 2.41 beta 4
ComboBox
DROPLIST
Same as using the control DropList.
Supported by: InstallOptions 1.0, InstallOptionsEx 2.41 beta 1
ListBox
MULTISELECT
Turns string selection on or off each time the user clicks or double-clicks
a string in the control. The user can select any number of strings.
Supported by: InstallOptions 1.4, InstallOptionsEx 2.41 beta 1
EXTENDEDSELECT
Allows multiple items to be selected by using the SHIFT key and the
mouse or special key combinations.
Disabled by flags: MULTISELECT.
Supported by: InstallOptionsEx 2.41 beta 11
EXTENDEDSELCT
Renamed to EXTENDEDSELECT.
For InstallOptionsEx 2.41 beta 10 and below:
Allows multiple items to be selected by using the SHIFT key and the
mouse or special key combinations.
Disabled by flags: MULTISELECT.
Supported by: InstallOptions 1.0, InstallOptionsEx 2.41 beta 1
VSCROLL
Shows a disabled vertical scroll bar when there is no need for one.
Disabled by flags: MULTISELECT.
Supported by: InstallOptions 2.4, InstallOptionsEx 2.41 beta 1
CheckBox/RadioButton
Makes the control to have an additional "indetermined" state. This is
generally used when some items are selected from another controls, but
not all of them. State can input and output the number 2 as that state.
Supported by: InstallOptionsEx 2.41 beta 7
Bitmap
RESIZETOFIT
Resizes the image to the size of the control. Also useful to support
custom DPI settings.
Supported by: InstallOptions 2.0, InstallOptionsEx 2.41 beta 1
Animation
CENTER
Included with controls.
For InstallOptionsEx 2.41 beta 10 and below:
Makes the animation to be centered.
Supported by: InstallOptionsEx 2.41 beta 1
TRANSPARENT
Removed.
For InstallOptionsEx 2.41 beta 10 and below:
Makes the first pixel of the animation to be the same as
the background color.
Supported by: InstallOptionsEx 2.41 beta 1
NOAUTOPLAY
Removed.
For InstallOptionsEx 2.41 beta 1:
Makes the animation to start paused.
Supported by: InstallOptionsEx 2.41 beta 1
ProgressBar
SMOOTH
Makes the progress bar smooth.
Supported by: InstallOptionsEx 2.41 beta 1
VSCROLL
Makes the progress bar to appear as a vertical progress bar with the
indicator bar starting from the bottom.
Supported by: InstallOptionsEx 2.41 beta 11
VERTICAL
Renamed to VSCROLL.
For InstallOptionsEx 2.41 beta 10 and below:
Makes the progress bar to appear as a vertical progress bar with the
indicator bar starting from the bottom.
Supported by: InstallOptionsEx 2.41 beta 1
TrackBar
TOOLTIPS
Makes the control show tooltips when the user changes the slider position.
Supported by: InstallOptionsEx 2.41 beta 2
NO_TICKS
Makes the control to don't show ticks on the control.
Supported by: InstallOptionsEx 2.41 beta 2
VSCROLL
Makes the control to be vertically orientated.
Supported by: InstallOptionsEx 2.41 beta 2
BACK_RECT
Removed.
For InstallOptionsEx 2.41 beta 10 and below:
Shows a white rectangle beneath the slider.
Supported by: InstallOptionsEx 2.41 beta 2
DateTime
UPDOWN
Makes the control to be like an UpDown control with a Text control, but
using date and time.
Supported by: InstallOptionsEx 2.41 beta 3
MonthCalendar
NOTODAY
Makes the control to do not display the today's date at the bottom of
the control and its red circle.
For InstallOptionsEx 2.41 beta 10 and below:
This does show its red circle.
Supported by: InstallOptionsEx 2.41 beta 3
NOTODAYCIRCLE
Included in NOTODAY flag.
For InstallOptionsEx 2.41 beta 10 and below:
Makes the control to do not display the today's date red circle
at the bottom of the control.
Supported by: InstallOptionsEx 2.41 beta 3
WEEKNUMBERS
Makes the control to display week numbers (1-52) to the left of each
row of days. Week 1 is defined as the first week that contains at least
four days.
Supported by: InstallOptionsEx 2.41 beta 3
Button
OPEN_FILEREQUEST
Makes the control to display a common dialog requiring a file for input to open.
Supported by: InstallOptionsEx 2.41 beta 11
FILEREQUEST
Renamed to OPEN_FILEREQUEST.
For InstallOptionsEx 2.41 beta 10 and below:
Makes the control to display a common dialog requiring a file
for input to open.
Supported by: InstallOptionsEx 2.41 beta 4
SAVE_FILEREQUEST
Makes the control to display a common dialog requiring a file for input to save on.
Supported by: InstallOptionsEx 2.41 beta 11
REQ_SAVE
Renamed to SAVE_FILEREQUEST.
For InstallOptionsEx 2.41 beta 10 and below:
Makes the control to display a common dialog requiring a file
for input to save on.
Supported by: InstallOptionsEx 2.41 beta 4
DIRREQUEST
Makes the control to display a common dialog requiring a directory for input.
Supported by: InstallOptionsEx 2.41 beta 4
FILE_MUST_EXIST
Determines if the selected file must exist. It only affects the
OPEN_FILEREQUEST dialog.
Required flags: OPEN_FILEREQUEST.
Supported by: InstallOptionsEx 2.41 beta 4
FILE_EXPLORER
Enables new file request look (recommended).
Required flags: OPEN_FILEREQUEST or SAVE_FILEREQUEST.
Supported by: InstallOptionsEx 2.41 beta 4
FILE_HIDEREADONLY
Hides the "open read only" check box.
Required flags: OPEN_FILEREQUEST.
Supported by: InstallOptionsEx 2.41 beta 4
WARN_IF_EXIST
Displays a warning message if the selected file already exists. It
only affects OPEN_FILEREQUEST or SAVE_FILEREQUEST dialogs.
Required flags: OPEN_FILEREQUEST or SAVE_FILEREQUEST.
Supported by: InstallOptionsEx 2.41 beta 4
PATH_MUST_EXIST
Prevents the user from typing a non-existent path. It only affects
OPEN_FILEREQUEST or SAVE_FILEREQUEST dialogs.
Required flags: OPEN_FILEREQUEST or SAVE_FILEREQUEST.
Supported by: InstallOptionsEx 2.41 beta 4
PROMPT_CREATE
Displays a warning if the selected file does not exist. However, it
still allows the user to select the file. It only affects
OPEN_FILEREQUEST dialogs.
Required flags: OPEN_FILEREQUEST.
Supported by: InstallOptionsEx 2.41 beta 4
BITMAP
Makes the control to show a bitmap instead of text. ICON flag
disables this flag.
Supported by: InstallOptionsEx 2.41 beta 2
ICON
Makes the control to show an icon instead of text.
Supported by: InstallOptionsEx 2.41 beta 2
Default Value: None
Supported by: InstallOptions 1.2, InstallOptionsEx 2.41 beta 1
TxtColor
Specifies the title text of a tooltip with BALLOON flag. It appears
bold above the normal tooltip text. If empty, no title will appear.
Default Value: "" (No title).
Supported by: InstallOptionsEx 2.41 beta 8
How to Use
Step 1: Using With Modern UI
As this is a different module than the original InstallOptions, none of
the commands provided by Modern UI supports InstallOptionsEx.dll, but you can
make a "trick" by renaming this dll to InstallOptions.dll. But remember, if you
use mixed Modern UI with these commands below, you'll have to call like you would
for the normal InstallOptions.dll. Both dlls calling are similar. If you do this
above, you can normally see instructions from Modern UI documentation.
Step 2: Extract the INI File
First, you have to extract the INI files for the dialogs in the
.onInit function:
Function .onInit
InitPluginsDir
File /oname=$PLUGINSDIR\test.ini test.ini
FunctionEnd
Step 3: Call the DLL
You can call InstallOptionsEx in a page function, check the
NSIS documentation for
information about the page system. Example:
Page custom SetCustom ValidateCustom
The InstallOptionsEx DLL has three functions:
- dialog - Creates the dialog immediately
- initDialog - Creates the dialog in memory, does not show
it
- show - Shows a dialog created in memory
Usually, you only need to use the dialog function:
Function SetCustom ;FunctionName defined with Page command
;Display the InstallOptionsEx dialog
Push $R0
InstallOptionsEx::dialog $PLUGINSDIR\test.ini
Pop $R0
FunctionEnd
Note that the page can be updated by changing anything on the INI file.
That means, you should secure it in difficult places so that no one can
change it when you're not expecting it. But this will probably change in future
versions.
Step 4: Get the Output
To get the input of the user, read the State value of a Field
using ReadINIStr:
ReadINIStr $R0 "$PLUGINSDIR\test.ini" "Field 1" "State"
Note:
Some InstallOptionsEx values are escaped to allow characters to
be used that are not normally valid in INI file values. For new lines,
carriage return and line feed, the affected values are:
- The ValidateText field
- The Text value of Label and Link fields
- The State value of Text fields that have the MULTILINE flag
- The DirRequest value of Button fields that have the DIRREQUEST flag
Every value of a value name is affected by variables
which are updated to the time the page was reserved or showed
without reserving.
Escape Characters and Variables:
$0-$9, $R0-$R9 - Variables
\r - Carriage return (ASCII 13)
\n - Line feed (ASCII 10)
\t - Tab (ASCII 9)
\\ - Back-slash
Step 5: Validate the Output
If you want to validate the input on the page, for example, you
want to check whether the user has filled in a textbox, use the
leave function of the Page command and Abort when the validation
has failed:
Function ValidateCustom
ReadINIStr $R0 "$PLUGINSDIR\test.ini" "Field 1" "State"
StrCmp $0 "" 0 +3
MessageBox MB_ICONEXCLAMATION|MB_OK "Please enter your name."
Abort
FunctionEnd
Step 6: Return Value
After you have called the DLL, InstallOptionsEx adds one string to
the stack, with one of the following values:
- success - The user has pressed the Next button
- back - The user has pressed the Back button
- cancel - The user has pressed the Cancel button
- error - An error has occurred, the dialog cannot be
displayed.
Usually, you don't need to check this value, but you still have
to remove it from the stack (have a look at the example above).
You only have to check this value if you need something really
special, such as doing something when the user pressed the Back
button.
Reserve Files
If you are using BZIP2 (solid) compression, it's important that
files which are being extracted in init- or page functions function
are located before other files in the data block, because this will
make your installer faster.
If there are File commands in your sections or functions above
the init- or page functions, add ReserveFile commands above your
sections and functions:
ReserveFile "test.ini"
ReserveFile "${NSISDIR}\Plugins\InstallOptionsEx.dll"
Version History
IOEx DLL version 2.4.1 beta 12