NSIS Noriyuki MUI

NSIS version 2.0 supports customizable user interface. The so-called Modern UI (hereinafter referred to as MUI) is a kind of imitation of the latest Windows interface style interface system. MUI has changed the habits of NSIS script writing to express it uses NSIS macro, specify the MUI properties require the use of macros. Therefore, such LicenseText, Icon, CheckBitmap, InstallColors meaningless in the MUI.

MUI's built-in wizard pages
and installation procedures wizard pages
MUI_PAGE_WELCOME the wizard page displays a welcome message
MUI_PAGE_LICENSE text / rtf_file the wizard page displays the software licensing affirms
MUI_PAGE_COMPONENTS the wizard page displays the installation component selection
MUI_PAGE_DIRECTORY the wizard page displays the security transfer directory selection
MUI_PAGE_STARTMENU page_id variable the wizard page displays the start menu, select the directory
MUI_PAGE_INSTFILES the wizard page displays the progress of the installation
MUI_PAGE_FINISH the end of the installation wizard page display

And unloading procedures wizard page
MUI_UNPAGE_WELCOME
MUI_UNPAGE_CONFIRM
MUI_UNPAGE_LICENSE text / rtf_file
MUI_UNPAGE_COMPONENTS
MUI_UNPAGE_DIRECTORY
MUI_UNPAGE_INSTFILES
MUI_UNPAGE_FINISH

Before attribute settings page needs to be put into a page macro. For example:
Var PLUGINS_FOLDER
! The DEFINE MUI_DIRECTORYPAGE_VARIABLE $ PLUGINS_FOLDER
insertmacro MUI_PAGE_DIRECTORY!
This nsi script says it will choose a variable catalog page directory location selected by the user is stored in the $ PLUGINS_FOLDER go.

The following is a built-in wizard pages each MUI Property Description:
all pages applicable properties
MUI_PAGE_HEADER_TEXT text
displays at the head of the wizard page

MUI_PAGE_HEADER_SUBTEXT text
displayed in the text wizard page head, which is usually displayed below MUI_PAGE_HEADER_TEXT, represents a further explanation of the MUI_PAGE_HEADER_TEXT.
For InstallOptions custom interface, use the macro! Insertmacro MUI_HEADER_TEXT "$ (TEXT_IO_TITLE) " "$ (TEXT_IO_SUBTITLE)" to achieve a similar function.

Welcome Page Properties
MUI_WELCOMEPAGE_TITLE title
to display the title on the Welcome page of the wizard

MUI_WELCOMEPAGE_TITLE_3LINES
blank header area

MUI_WELCOMEPAGE_TEXT text
display text on the Welcome page of the wizard. Use \ r \ n newline.
Usually these attributes do not need to develop provincial lack of sufficient value.

Software Licensing page properties
in software licensing page can be customized to the user accepts the software license in three ways, one button, and second checkbox, the third is radio.
MUI_LICENSEPAGE_TEXT_TOP text
display text at the top of the page

MUI_LICENSEPAGE_TEXT_BOTTOM text
display text at the bottom of the page

MUI_LICENSEPAGE_BUTTON button_text
text on the button mode button

MUI_LICENSEPAGE_CHECKBOX
Define this indicates that the user needs to VGH the checkbox to accept the software license

MUI_LICENSEPAGE_CHECKBOX_TEXT text
text that appears next to the checkbox

MUI_LICENSEPAGE_RADIOBUTTONS
Define this indicates that the user needs to VGH radio box corresponding to accept or reject the software licensing

MUI_LICENSEPAGE_RADIOBUTTONS_TEXT_ACCEPT text
next to the radio acceptance of the text display

MUI_LICENSEPAGE_RADIOBUTTONS_TEXT_DECLINE text
rejected the text displayed next to the radio

Installation component selection page property

MUI_COMPONENTSPAGE_TEXT_TOP text
display text at the top of the page

MUI_COMPONENTSPAGE_TEXT_COMPLIST text
display text next to the list of components

MUI_COMPONENTSPAGE_TEXT_INSTTYPE text
display text next to the security transfer type pulldown

MUI_COMPONENTSPAGE_TEXT_DESCRIPTION_TITLE text
display text at the top of the box described

MUI_COMPONENTSPAGE_TEXT_DESCRIPTION_INFO text
when the component is not installed when selected, display text in the description box

Installation directory selection page properties

MUI_DIRECTORYPAGE_TEXT_TOP text
display text at the top of the page

MUI_DIRECTORYPAGE_TEXT_DESTINATION text
displayed in the text box on the head to the directory selection

MUI_DIRECTORYPAGE_VARIABLE variable
storage directory user-selected variables, the default is $ INSTDIR

MUI_DIRECTORYPAGE_VERIFYONLEAVE
verify the directory at the time of leaving the page validity, can not help with the "Next" button

Start menu, select Contents Page

Create a shortcut code should be placed between MUI_STARTMENU_WRITE_BEGIN and MUI_STARTMENU_WRITE_END, examples are as follows:
! Insertmacro MUI_STARTMENU_WRITE_BEGIN page_id
... the Create Shortcuts ...
insertmacro MUI_STARTMENU_WRITE_END!

page_id here is the user to select the page you want to create a shortcut.

MUI_STARTMENUPAGE_TEXT_TOP text
display text at the top of the page

MUI_STARTMENUPAGE_TEXT_CHECKBOX text
display text representing checkbox next to ban the shortcut created

MUI_STARTMENUPAGE_DEFAULTFOLDER folder
the default Start menu directory

MUI_STARTMENUPAGE_NODISABLE
not implement a ban shortcuts created checkbox

The root MUI_STARTMENUPAGE_REGISTRY_ROOT
MUI_STARTMENUPAGE_REGISTRY_KEY Key
MUI_STARTMENUPAGE_REGISTRY_VALUENAME value_name
three start menu for designating and setting key value in the registry for recording the user's preference. Should be deleted when you uninstall it.
Uninstaller can be obtained using the macro MUI_STARTMENU_GETFOLDER Start menu directory, the following example shows how to delete a shortcut:
! Insertmacro MUI_STARTMENU_GETFOLDER page_id $ R0
the Delete "$ SMPROGRAMS \ $ R0 \ Your Shortcut.lnk"

Installation Progress page properties

MUI_INSTFILESPAGE_FINISHHEADER_TEXT text
display text installation progress page head, but for the end of the page is not MUI_ (UN) FINISHPAGE_NOAUTOCLOSE) is not displayed.

MUI_INSTFILESPAGE_FINISHHEADER_SUBTEXT text
display, further progress of the installation instructions page for MUI_INSTFILESPAGE_FINISHHEADER_TEXT the head. For the end of the page is not MUI_ (UN) FINISHPAGE_NOAUTOCLOSE) is not displayed.

MUI_INSTFILESPAGE_ABORTHEADER_TEXT text
display text installation progress page indicates the head of the installation process abnormally terminated

MUI_INSTFILESPAGE_ABORTHEADER_SUBTEXT text
further description of the MUI_INSTFILESPAGE_ABORTHEADER_TEXT

Complete page properties

You can run the program in a complete page, open a file or Web site.

MUI_FINISHPAGE_TITLE title
page title

MUI_FINISHPAGE_TITLE_3LINES
extra space area of the page title

MUI_FINISHPAGE_TEXT text
displayed in the text page is completed, with \ r \ n newline

MUI_FINISHPAGE_TEXT_LARGE
extra space the text area if you use a checkbox, need to be set

MUI_FINISHPAGE_BUTTON text
to complete the display text button

MUI_FINISHPAGE_TEXT_REBOOT text
restart the text next to the operating system checkbox, with \ r \ n newline

MUI_FINISHPAGE_TEXT_REBOOTNOW text
display text next to the 'Reboot now' of

MUI_FINISHPAGE_TEXT_REBOOTLATER text
display text next to the 'Reboot later' of

MUI_FINISHPAGE_RUN exe_file
specified user can select the checkbox to run the application, if there are spaces without reference.

MUI_FINISHPAGE_RUN_TEXT text
text checkbox next to the running application

MUI_FINISHPAGE_RUN_PARAMETERS parameters
parameters to run the application, you need to use $ \ "represents the double quotation marks

MUI_FINISHPAGE_RUN_NOTCHECKED
designated non-running applications checkbox selected

FUNCTION_NAME MUI_FINISHPAGE_RUN_FUNCTION
NSI function to be executed after the designated installation, you can run multiple applications in this function.

MUI_FINISHPAGE_SHOWREADME file / url
specified user can use the checkbox to select the file or Web site you are viewing, if there are spaces without reference.

MUI_FINISHPAGE_SHOWREADME_TEXT text
specifies the text displayed next to the 'Show Readme' checkbox

MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
designated 'Show Readme' checkbox non-selected state

MUI_FINISHPAGE_SHOWREADME_FUNCTION function_name
specifies the installation nsis function to be executed after completion, can display multiple files or websites in this function.

MUI_FINISHPAGE_LINK link_text
text on the hyperlink and the user can click on

MUI_FINISHPAGE_LINK_LOCATION file / url
Specify whether the user can view the site with hyperlinks, if there are spaces without reference.

MUI_FINISHPAGE_LINK_COLOR (color: RRGGBB hexadecimal)
hyperlink on the color of the text, the default is 000080

MUI_FINISHPAGE_NOREBOOTSUPPORT
disable restart of the operating system functions

Uninstall confirmation page properties

MUI_UNCONFIRMPAGE_TEXT_TOP text
display text at the top of the page

MUI_UNCONFIRMPAGE_TEXT_LOCATION text
display text next to the uninstall location


InstallOptions and custom page
InstallOptions NSIS is a plug-in, he can make the installer developers to create custom wizard pages to get user input Built-in wizard pages can not provide.

InstallOptions creates a dialog box embedded in NSIS form. InstallOptions controls described by INI file. This file can be generated using a visual tool. HM NIS EDIT is one such tool.

INI file structure InstallOptions control
InstallOptions INI file must contain a segment. It contains a number of forms of property of the control and so on. The paper may also include sections describe specific space.
Required section is Settings, which may include the following:
NumFields (a must) the number of controls of the dialog box contains a
Title (optional) Windows Forms title
CancelEnabled (optional) Cancel button is enabled, 1: Yes, 0: No
CancelShow (optional) whether to display the Cancel button, 1: yes, 0: no
BackEnabled (optional) Back button is enabled, 1: yes, 0: no
CancelButtonText display text (optional) Cancel button
NextButtonText (optional) display text Next button
BackButtonText display text (optional) Back button
Rect (optional)
RTL (optional)
State (the Output) This iS Supply's not something you have have to Yourself But the SET iS by InstallOptions, before calling your custom page validation function, to the field number of the custom Button control (or other control having the Notify flag) the user pressed, if any.

Each control segment to "Field #" model name, the pound sign represents a number, starting at 1. Control has the following properties:

Type (required) 控件的类型,有"Label", "Text", "Password", "Combobox", "DropList", "Listbox", "CheckBox", "RadioButton", "FileRequest" , "DirRequest" "Icon", "Bitmap", "GroupBox", "Link" 或 "Button"。

"Label" is used to display static text
"Text" and "Password" and the like in HTML for receiving user input.
"Combobox" allows the user to enter a list of items that do not exist, "Droplist" you can only select items specified in the list.
"Listbox" show more options (do not pull down to see), and allows multiple selections
"CheckBox" "RadioButton" and the corresponding controls similar to Windows.
"FileRequest" an input field and a Browse button that allows the user to select the file with the file selection dialog.
"DirRequest" and "FileRequest" similar, but only to the selected directory.
"Icon" display icon
"Bitmap" Display Bitmap
"GroupBox" combo box
"Link" displayed hyperlink
"Button" button

Text (optional) on the checkbox, radio button control is a caption; DirRequest control is to browse dialog title; icons, bitmaps control is the path to the image file.

State (optional) control state, which can be read in nsi script. For text type of control, the value of the state of the user input string. For radio button and check boxes state '0' or '1'. On the list boxes, combo boxes, and drop lists status values ​​are selected option, if there are a plurality of pipe symbol '|' split. For buttons and hyperlinks State ShellExecute string can be performed.

The ListItems (optional) with a pipe symbol between combobox, droplist, or the listbox, Options '|' split
MaxLen is (optional) maximum input length
minlen (optional) minimum input length
ValidateText (optional) correction test text

Left
Right
Top
Bottom (required) control coordinates, is not important in the visual environment.
Filter (optional) specifies the "FileRequest" control file filters, patterns such as text files | * .txt | Program Files | * .exe; * com | All Files | * *..

Root (optional) specifies the root directory "DirRequest" controls
Flags modified (optional) specified control. A plurality of values pipe symbol '|' split and no spaces. Valid values are as follows:
Value Meaning
REQ_SAVE the "FileRequest" controls into a "Save As" dialog
FILE_MUST_EXIST for "FileRequest" control, specify whether the selected file must exist
FILE_EXPLORER for "FileRequest" control
FILE_HIDEREADONLY for "FileRequest" controls hidden "Open the Read only" the CheckBox
WARN_IF_EXIST for "FileRequest" controls, displays a warning if the file already exists
PATH_MUST_EXIST for "FileRequest" control, enter the path specified must exist
PROMPT_CREATE for "FileRequest" controls, displays a warning if before creating file path does not exist or
RIGHT for "Checkbox" and Radiobutton "controls, the provisions of the text appears on the left, rarely used
MULTISELECT for" Listbox "control allows multiple selections
EXTENDEDSELCT for" Listbox "control allows multiple selections
RESIZETOFIT for" Bitmap "
Controls, will be expanded to the size of the picture controls GROUP more than one control group, the logo on the first control in the same group.
NOTABSTOP prohibit the tab key focus falls on the control
DISABLED disable controls
ONLY_NUMBERS for "Text" controls, at The Forces the User to Edit the Enter only a Numbers INTO at The Box.
MULTILINE for "Text" controls that allow multi-line input
WANTRETURN for "Text" controls that allow multi-line input, press the Enter key provisions when inserted into the transport
NOWORDWRAP for the "text" control that allows multi-line input disable wrap-Word
HScroll horizontal scroll bars
VSCROLL vertical scroll bars
rEADONLY for the "text" controls the text input boxes become read-only
NOTIFY for "Button", "Link", "CheckBox", "RadioButton", "ListBox" and "dropList" control. InstallOptions trigger the event, call the custom page validation / leave method.
TxtColor (optional) for "Link" control, specifying the text foreground color, format: 0xBBRRGG (hex)

To use custom wizard page:
1. Design a custom wizard page interface, the interface description is generated ini files, you can use HM NIS Edit visualization tools to simplify the development
2. Write nsi script:
First of all, if you use lzma, gzip and other compression algorithms, need reserve customize the interface before all file command ini file: ReserveFile ".ini".
Then, use a macro! Insertmacro MUI_INSTALLOPTIONS_EXTRACT ".ini" in .onInit method.
Then, write a function to display custom dialogs.
Finally, insert the wizard page in the right position with the Page directive.

Custom dialog box displays the example of a function:
Function setChooseBuildArea
! Insertmacro MUI_HEADER_TEXT "Please select the build directory" "Please select the build directory"
buildarea.ini "" Field, 2 "," State "," $ INSTDIR \ buildarea "insertmacro MUI_INSTALLOPTIONS_WRITE!"
Insertmacro MUI_INSTALLOPTIONS_DISPLAY "! buildarea.ini "
FunctionEnd
the head of the first line of text Setup Wizard page of the function; second line of code setup wizard second page for the control of State" $ INSTDIR \ buildarea ", which is set default values for the control ; third line displays the dialog box.
Insert Wizard page with the Page directive code is as follows:
Page Custom setChooseBuildArea "" "- Select the build directory"
This command takes three arguments, the first two are shown as a function of the page and leave the function, and the third is displayed in the title bar Text.

nsi variables If you store the string, it can only be saved by default 1024. For complex Java applications, due to the need to set up its command-line length Classpath tend to over 1024. At this point, let nsi must support variable string lengths greater than 1024. There are two ways to solve this problem, one is to http: //nsis.sourceforge.net/download/specialbuilds/ at Download Special Builds, currently called build support Large strings of characters can be stored in variables 8192; the other one is manually compile NSIS source code, plus the option you want.

Guess you like

Origin www.cnblogs.com/gq0324/p/11095087.html