!define APP_NAME "Modern UI Test"
;!define INSTALL_PATH "Software\${APP_NAME}"
!define UNINSTALL_PATH "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}"
!define MULTIUSER_EXECUTIONLEVEL Highest
;!define MULTIUSER_NOUNINSTALL ;Uncomment if no uninstaller is created
!define MULTIUSER_MUI
!define MULTIUSER_INSTALLMODE_COMMANDLINE
!define MULTIUSER_INSTALLMODE_INSTDIR "${APP_NAME}"
!define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY "${UNINSTALL_PATH}"
!define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME "UninstallString"
;!define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY "${INSTALL_PATH}"
;!define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME "InstallLocation"
!define REG_ROOT "SHCTX"
!include MultiUser.nsh
!include "MUI2.nsh"
;--------------------------------
;General
;Name and file
Name "${APP_NAME}"
OutFile "Basic.exe"
;Default installation folder
;InstallDir "$LOCALAPPDATA\Modern UI Test"
;Get installation folder from registry if available
;InstallDirRegKey HKCU "Software\Modern UI Test" ""
;Request application privileges for Windows Vista
;RequestExecutionLevel user
;--------------------------------
;Variables
Var StartMenuFolder
;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
;--------------------------------
;Language Selection Dialog Settings
;Remember the installer language
;!define MUI_LANGDLL_REGISTRY_ROOT "SHCTX"
;!define MUI_LANGDLL_REGISTRY_KEY "${APP_NAME}"
;!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
;--------------------------------
;Pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MULTIUSER_PAGE_INSTALLMODE
!insertmacro MUI_PAGE_DIRECTORY
;Start Menu Folder Page Configuration
;!define MUI_STARTMENUPAGE_DEFAULTFOLDER "${APP_NAME}"
;!define MUI_STARTMENUPAGE_REGISTRY_ROOT "SHCTX"
;!define MUI_STARTMENUPAGE_REGISTRY_KEY "${UNINSTALL_PATH}"
;!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
;!insertmacro MUI_LANGUAGE "Korean"
;--------------------------------
;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.
!insertmacro MUI_RESERVEFILE_LANGDLL
;--------------------------------
;Installer Sections
Section "Dummy Section" SecDummy
SetOutPath "$INSTDIR"
;ADD YOUR OWN FILES HERE...
File test.txt
;Store installation folder
;WriteRegStr HKCU "Software\Modern UI Test" "" $INSTDIR
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
;WriteRegStr ${REG_ROOT} "${INSTALL_PATH}" "InstallPath" "$INSTDIR"
;WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayName" "${APP_NAME}"
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "UninstallString" "$INSTDIR\Uninstall.exe"
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
;--------------------------------
;Installer Functions
Function .onInit
;!insertmacro MUI_LANGDLL_DISPLAY
!insertmacro MULTIUSER_INIT
FunctionEnd
;--------------------------------
;Descriptions
;Language strings
;USE A LANGUAGE STRING IF YOU WANT YOUR DESCRIPTIONS TO BE LANGAUGE SPECIFIC
LangString DESC_SecDummy ${LANG_ENGLISH} "A test section."
;LangString DESC_SecDummy ${LANG_KOREAN} ".."
;Assign descriptions to sections
;Assign language strings to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
;--------------------------------
;Uninstaller Section
Section "Uninstall"
;ADD YOUR OWN FILES HERE...
delete $INSTDIR\test.txt
Delete "$INSTDIR\Uninstall.exe"
RMDir "$INSTDIR"
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk"
RMDir /r "$SMPROGRAMS\$StartMenuFolder"
DeleteRegKey ${REG_ROOT} "${UNINSTALL_PATH}"
;DeleteRegKey ${REG_ROOT} "${INSTALL_PATH}"
;DeleteRegKey /ifempty HKCU "Software\Modern UI Test"
SectionEnd
;--------------------------------
;Uninstaller Functions
Function un.onInit
!insertmacro MULTIUSER_UNINIT
;!insertmacro MUI_UNGETLANGUAGE
FunctionEnd