Меню сайта
Что нужно сделать быстрее?
Всего ответов: 113
Поддержать проект
    Состояние ICQ в данный моментICQ: 368-000-200 (админ)
      Состояние в данный моментMRA: rus-open-source(админ)


The Modern UI provides a user interface for NSIS installers with a modern wizard style, similar to the wizards of recent Windows versions. It is based on the basic user interface that is provided by the NSIS compiler itself and extends it with more interface features and pages.

All standard NSIS pages (such as the pages to select components and the installation folder) are supported as well as a number of additional pages. The welcome page allows you to provide an introduction to the installation process, while the finish page provides a way to let the user decide what steps should be performed after the setup wizard is closed (for example, whether the application should be started immediately). A finish page can also be used to ask for a system restart is necessary.

Вид программы

Внешний вид програмыВнешний вид програмы

Modern UI 2.0

This new version makes it easier to customize pages, because the same method can be used to  change standard NSIS pages as well as additional pages provided by the Modern UI. It is now also possible for other NSIS plug-ins to add new pages to the Modern UI. You can expect to see examples of this soon.

The welcome and finish page are no longer implemented using InstallOptions. Instead, the new nsDialogs plug-in is used. nsDialogs allows you to create custom pages or customize existing pages directly from the script.

To upgrade a Modern UI 1.8 script, you should:

Insert the MUI2.nsh header file instead of MUI.nsh. The macros for InstallOptions have been moved to a separate header file unrelated to the Modern UI. If you are still using InstallOptions for custom pages, insert InstallOptions.nsh and use the INSTALLOPTIONS_* macros instead of the MUI_INSTALLOPTIONS_* macros. The macros themselves have remained the same. Rewrite customization code for the Modern UI 1.8 welcome and finish pages in which the InstallOptions INI file is used. nsDialogs commands should be used instead. Use the standard NSIS method to escape special characters in all texts. For example, $\r$\n creates newline. Script header The settings for the Modern UI should be inserted in the header of the script file. It's important to follow the same order as the items below. For example, interface settings should be defined before you insert pages, because the pages depend on the interface configuration. It may be useful to look at the example scripts too see how this is done in actual script files.

Parameters are given in this format: required (option1 | option2) [optional]

1. Header file First of all, add this line to the top of script to include the Modern UI:

!include MUI2.nsh

2. Interface configuration

Then, you may want to use interface settings to change the look and feel of the installer. These settings apply to all pages.

The interface settings provided by the NSIS compiler itself (such as LicenseText, Icon, CheckBitmap, InstallColors) should not be used in Modern UI scripts. The Modern UI provides equalivent or extended versions of these settings.


!define MUI_UI "myUI.exe" ;Значение
!define MUI_INSTFILESPAGE_COLORS "FFFFFF 000000" ;Два цвета

3. Pages

Insert the following macros to set the pages you want to use. The pages will appear in the order in which you insert them in the script. You can also insert custom Page commands between the macros to add custom pages.

You can add multiple pages of certain types (for example, if you want the user to specify multiple folders).


!insertmacro MUI_PAGE_LICENSE "License.rtf" !insertmacro MUI_PAGE_COMPONENTS

Var StartMenuFolder !insertmacro MUI_PAGE_STARTMENU "Application" $StartMenuFolder You will need the page ID for the Start Menu folder page when using the Start Menu folder macros. The folder will be stored in the specified variable.



4. Language files

Insert the Modern UI language files for the languages to want to include.

!insertmacro MUI_LANGUAGE "English" The standard NSIS language files are loaded automatically, there is no need to use LoadLanguageFile.

5. Reserve files If you are using solid compression, files that are required before the actual installation should be stored first in the data block, because this will make your installer start faster. Include reserve file commands for such files before your sections and functions:

ReserveFile MyPlugin.dll !insertmacro MUI_RESERVEFILE_LANGDLL ;Language selection dialog ... Script code for pages Some pages allow you to show additional information or can be used to get user input. Here you can find the script code to use these features.

Components page descriptions The Modern UI components page has a text box in which a description can be shown when the user hovers the mouse over a component. If you don't want to use these descriptions, insert the MUI_COMPONENTSPAGE_NODESC interface setting.

To set a description for a section, an additional parameter needs to be added to Section commmand with a unique identifier for the section. This name can later be used to set the description for this section.

Section "Section Name 1" Section1    ... SectionEnd After the sections, use these macros to set the descriptions:

LangString DESC_Section1 ${LANG_ENGLISH} "Description of section 1." LangString DESC_Section2 ${LANG_ENGLISH} "Description of section 2."

!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN   !insertmacro MUI_DESCRIPTION_TEXT ${Section1} $(DESC_Section1)   !insertmacro MUI_DESCRIPTION_TEXT ${Section2} $(DESC_Section2) !insertmacro MUI_FUNCTION_DESCRIPTION_END For the uninstaller, use the MUI_UNFUNCTION_DESCRIPTION_BEGIN and MUI_UNFUNCTION_DESCRIPTION_END macros.

Start Menu folder Put the code to write the shortcuts (using CreateShortcut) between the MUI_STARTMENU_WRITE_BEGIN and MUI_STARTMENU_WRITE_END macros:

!insertmacro MUI_STARTMENU_WRITE_BEGIN pageid   ...create shortcuts... !insertmacro MUI_STARTMENU_WRITE_END The page ID should be the ID of the page on which the user has selected the folder for the shortcuts you want to write.

The variable which contains the folder and the page ID are set as parameters of the page macro.

Language selection dialog

If you want the installer to display a language selection dialog (see the the MultiLanguage.nsi example), insert the MUI_LANGDLL_DISPLAY macro in the .onInit function:

Function .onInit

  !insertmacro MUI_LANGDLL_DISPLAY


This macro can also be used in the un.onInit function.

Settings for registry storage of selected language

Interface settings for selection dialog

Custom pages

If you want add your custom pages to your installer, you can insert your own page commands between the page macros.

!insertmacro MUI_PAGE_WELCOME Page custom FunctionName ;Custom page !insertmacro MUI_PAGE_COMPONENTS   ;Uninstaller !insertmacro MUI_UNPAGE_CONFIRM UninstPage custom un.FunctionName ;Custom page !insertmacro MUI_UNPAGE_INSTFILES Use the MUI_HEADER_TEXT macro to set the text on the page header in a page function:


Function CustomPageFunction   !insermacro MUI_HEADER_TEXT $(PAGE_TITLE) $(PAGE_SUBTITLE)   ... FuctionEnd Custom functions Interface functions provided by NSIS, like the .onGUIInit function and the page functions are automatically included by the Modern UI and filled with code to support new interface features. If you want to add additional code to these function, create a function with the custom script code in the script use the Modern UI functions call them.



Function myGUIInit   ... FunctionEndModern UI pages can also customized using custom functions.

General Custom Functions

Page Custom Functions

Welcome/Finish Page Custom Functions

Примеры скриптов

Basic: Basic.nsi
Welcome/Finish page: WelcomeFinish.nsi
Multiple languages: MultiLanguage.nsi
Header image: HeaderBitmap.nsi
Start Menu Folder page: StartMenu.nsi


Written by Joost Verburg.
Icons designed by Nikos Adamamas, aka adni18.
Thanks to Amir Szekely, aka KiCHiK, for his work on NSIS to make this possible.


The zlib/libpng license applies to the Modern UI.

Условия лицензионного соглашения

Ваш профиль
Здравствуйте, Гость!
У Вас пока нет аватара, т.к. Вы либо не зарегистрированы либо не авторизованы
Гость, мы рады Вас видеть! Пожалуйста, зарегистрируйтесь или авторизуйтесь!
Друзья сайта
Система Orphus
Онлайн всего: 1
Гостей: 1
Пользователей: 0

Нас считают:
Яндекс цитированияРейтинг@Mail.ru
© Copyright 2017 NSIS по-русски
Все права на материалы, находящиеся на сайте nsis.ucoz.ru, охраняются в соответствии с законодательством РФ, в том числе, об авторском праве и смежных правах. Перепечатка материалов допускается только по письменному согласованию с правообладателями контента. При любом использовании материалов сайта, гиперссылка обязательна.
Внимание! Редакция сайта не несет ответственности за содержание интернет-ресурсов, на которые есть ссылки на этом сайте.