
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2571 212acab6-be3b-0410-9dea-997c60f758d6
154 lines
No EOL
3.5 KiB
NSIS
154 lines
No EOL
3.5 KiB
NSIS
;NSIS Modern User Interface version 1.65
|
|
;InstallOptions Example Script
|
|
;Written by Joost Verburg
|
|
|
|
!define TEMP $R0
|
|
|
|
;--------------------------------
|
|
;Include Modern UI
|
|
|
|
!include "MUI.nsh"
|
|
|
|
;--------------------------------
|
|
;Product Info
|
|
|
|
!define MUI_PRODUCT "Modern UI Test"
|
|
!define MUI_VERSION "1.65"
|
|
|
|
;--------------------------------
|
|
;Configuration
|
|
|
|
;General
|
|
OutFile "InstallOptions.exe"
|
|
|
|
;Folder selection page
|
|
InstallDir "$PROGRAMFILES\${MUI_PRODUCT}"
|
|
|
|
;Get install folder from registry if available
|
|
InstallDirRegKey HKCU "Software\${MUI_PRODUCT}" ""
|
|
|
|
;--------------------------------
|
|
;Pages
|
|
|
|
!insertmacro MUI_PAGE_LICENSE
|
|
Page custom CustomPageA
|
|
!insertmacro MUI_PAGE_COMPONENTS
|
|
Page custom CustomPageB
|
|
!insertmacro MUI_PAGE_DIRECTORY
|
|
Page custom CustomPageC
|
|
!insertmacro MUI_PAGE_INSTFILES
|
|
|
|
!insertmacro MUI_UNPAGE_CONFIRM
|
|
!insertmacro MUI_UNPAGE_INSTFILES
|
|
|
|
;--------------------------------
|
|
;Modern UI Configuration
|
|
|
|
!define MUI_ABORTWARNING
|
|
|
|
;--------------------------------
|
|
;Languages
|
|
|
|
!insertmacro MUI_LANGUAGE "English"
|
|
|
|
;--------------------------------
|
|
;Data
|
|
|
|
LicenseData "${NSISDIR}\Contrib\Modern UI\License.txt"
|
|
|
|
;--------------------------------
|
|
;Reserve Files
|
|
|
|
;Things that need to be extracted on first (keep these lines before any File command!)
|
|
;Only for BZIP2 compression
|
|
|
|
ReserveFile "ioA.ini"
|
|
ReserveFile "ioB.ini"
|
|
ReserveFile "ioC.ini"
|
|
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
|
|
|
|
;--------------------------------
|
|
;Installer Sections
|
|
|
|
Section "Dummy Test File" SecCopyUI
|
|
|
|
;ADD YOUR OWN STUFF HERE!
|
|
|
|
SetOutPath "$INSTDIR"
|
|
File "${NSISDIR}\Contrib\UIs\modern.exe"
|
|
|
|
;Store install folder
|
|
WriteRegStr HKCU "Software\${MUI_PRODUCT}" "" $INSTDIR
|
|
|
|
;Create uninstaller
|
|
WriteUninstaller "$INSTDIR\Uninstall.exe"
|
|
|
|
;Read a value from an InstallOptions INI file
|
|
!insertmacro MUI_INSTALLOPTIONS_READ ${TEMP} "ioC.ini" "Field 2" "State"
|
|
|
|
;Display a messagebox if check box was checked
|
|
StrCmp ${TEMP} "1" "" +2
|
|
MessageBox MB_OK "You checked the check box, here is the MessageBox..."
|
|
|
|
SectionEnd
|
|
|
|
;--------------------------------
|
|
;Installer Functions
|
|
|
|
Function .onInit
|
|
|
|
;Extract InstallOptions INI files
|
|
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "ioA.ini"
|
|
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "ioB.ini"
|
|
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "ioC.ini"
|
|
|
|
FunctionEnd
|
|
|
|
LangString TEXT_IO_TITLE ${LANG_ENGLISH} "InstallOptions page"
|
|
LangString TEXT_IO_SUBTITLE ${LANG_ENGLISH} "This is a page created using the InstallOptions plug-in."
|
|
|
|
Function CustomPageA
|
|
|
|
!insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"
|
|
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "ioA.ini"
|
|
|
|
FunctionEnd
|
|
|
|
Function CustomPageB
|
|
|
|
!insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"
|
|
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "ioB.ini"
|
|
|
|
FunctionEnd
|
|
|
|
Function CustomPageC
|
|
|
|
!insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"
|
|
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "ioC.ini"
|
|
|
|
FunctionEnd
|
|
|
|
;--------------------------------
|
|
;Descriptions
|
|
|
|
LangString DESC_SecCopyUI ${LANG_ENGLISH} "Copy modern.exe to the application folder."
|
|
|
|
!insertmacro MUI_FUNCTIONS_DESCRIPTION_BEGIN
|
|
!insertmacro MUI_DESCRIPTION_TEXT ${SecCopyUI} $(DESC_SecCopyUI)
|
|
!insertmacro MUI_FUNCTIONS_DESCRIPTION_END
|
|
|
|
;--------------------------------
|
|
;Uninstaller Section
|
|
|
|
Section "Uninstall"
|
|
|
|
;ADD YOUR OWN STUFF HERE!
|
|
|
|
Delete "$INSTDIR\modern.exe"
|
|
Delete "$INSTDIR\Uninstall.exe"
|
|
|
|
RMDir "$INSTDIR"
|
|
|
|
DeleteRegKey /ifempty HKCU "Software\${MUI_PRODUCT}"
|
|
|
|
SectionEnd |