2002-10-26 17:39:56 +00:00
|
|
|
;NSIS Modern User Interface version 1.3
|
|
|
|
;Advanced Macro System & Install Options Example Script
|
2002-09-20 23:02:38 +00:00
|
|
|
;Written by Joost Verburg
|
|
|
|
|
|
|
|
!define NAME "Test Software" ;Define your own software name here
|
|
|
|
!define VERSION "1.0" ;Define your own software version here
|
|
|
|
|
2002-10-26 21:51:39 +00:00
|
|
|
!include "${NSISDIR}\Contrib\Modern UI\System.nsh"
|
2002-09-20 23:02:38 +00:00
|
|
|
|
|
|
|
;--------------------------------
|
2002-09-22 13:33:53 +00:00
|
|
|
;Configuration
|
2002-10-26 22:09:54 +00:00
|
|
|
|
2002-10-13 18:25:07 +00:00
|
|
|
!define MUI_INSTALLOPTIONS
|
|
|
|
|
2002-10-08 09:29:03 +00:00
|
|
|
!define MUI_LICENSEPAGE
|
|
|
|
!define MUI_COMPONENTPAGE
|
|
|
|
!define MUI_DIRSELECTPAGE
|
|
|
|
!define MUI_INSTALLBUTTONTEXT_NEXT
|
2002-10-13 18:28:38 +00:00
|
|
|
!define MUI_ABORTWARNING
|
2002-10-08 09:29:03 +00:00
|
|
|
!define MUI_UNINSTALLER
|
2002-10-26 12:25:02 +00:00
|
|
|
|
|
|
|
!define MUI_SETPAGE_FUNCTIONNAME "SetPage"
|
|
|
|
!define MUI_UNSETPAGE_FUNCTIONNAME "un.SetPage"
|
2002-10-26 22:09:54 +00:00
|
|
|
|
|
|
|
!define TEMP1 $R0
|
2002-10-08 09:29:03 +00:00
|
|
|
|
2002-10-07 19:59:01 +00:00
|
|
|
;Language
|
|
|
|
;English
|
|
|
|
LoadLanguageFile "${NSISDIR}\Contrib\Language files\English.nlf"
|
2002-10-12 15:57:47 +00:00
|
|
|
!include "${NSISDIR}\Contrib\Modern UI\Language files\English.nsh"
|
2002-10-07 19:59:01 +00:00
|
|
|
|
2002-09-20 23:02:38 +00:00
|
|
|
;General
|
|
|
|
Name "${NAME} ${VERSION}"
|
|
|
|
OutFile "InstallOptions.exe"
|
|
|
|
|
2002-10-26 17:39:56 +00:00
|
|
|
!insertmacro MUI_INTERFACE
|
2002-09-25 18:46:36 +00:00
|
|
|
!insertmacro MUI_INSTALLOPTIONS "$7" "$8" ;Variables for the Install Options system. Do not use them in .onNext/PrevPage and SetPage
|
2002-09-20 23:02:38 +00:00
|
|
|
|
2002-10-26 17:39:56 +00:00
|
|
|
;License page
|
2002-10-12 16:16:46 +00:00
|
|
|
LicenseData "${NSISDIR}\Contrib\Modern UI\License.txt"
|
2002-09-20 23:02:38 +00:00
|
|
|
|
2002-10-26 17:39:56 +00:00
|
|
|
;Component-selection page
|
2002-10-07 19:59:01 +00:00
|
|
|
;Descriptions
|
|
|
|
LangString DESC_SecCopyUI ${LANG_ENGLISH} "Copy the modern.exe file to the application folder."
|
|
|
|
LangString DESC_SecCreateUninst ${LANG_ENGLISH} "Create a uninstaller which can automatically delete ${NAME}."
|
2002-09-20 23:02:38 +00:00
|
|
|
|
2002-10-26 17:39:56 +00:00
|
|
|
;Folder-selection page
|
2002-09-20 23:02:38 +00:00
|
|
|
InstallDir "$PROGRAMFILES\${NAME}"
|
2002-10-07 19:59:01 +00:00
|
|
|
|
2002-10-26 17:39:56 +00:00
|
|
|
;Install Options pages
|
2002-10-07 19:59:01 +00:00
|
|
|
LangString MUI_TEXT_IO_TITLE ${LANG_ENGLISH} "Install Options Page"
|
|
|
|
LangString MUI_TEXT_IO_SUBTITLE ${LANG_ENGLISH} "Create your own dialog!"
|
|
|
|
|
2002-09-22 13:33:53 +00:00
|
|
|
;Things that need to be extracted on startup (keep these lines before any File command!)
|
|
|
|
;Use ReserveFile for your own Install Options ini files too!
|
|
|
|
ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
|
2002-10-07 19:59:01 +00:00
|
|
|
ReserveFile "ioA.ini"
|
|
|
|
ReserveFile "ioB.ini"
|
|
|
|
ReserveFile "ioC.ini"
|
2002-09-22 13:33:53 +00:00
|
|
|
|
2002-09-20 23:02:38 +00:00
|
|
|
;--------------------------------
|
|
|
|
;Installer Sections
|
|
|
|
|
2002-10-07 19:59:01 +00:00
|
|
|
Function .onInit
|
|
|
|
|
|
|
|
;Init InstallOptions
|
|
|
|
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "ioA.ini"
|
|
|
|
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "ioB.ini"
|
|
|
|
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "ioC.ini"
|
|
|
|
|
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
Section "modern.exe" SecCopyUI
|
2002-09-20 23:02:38 +00:00
|
|
|
|
|
|
|
;Add your stuff here
|
|
|
|
|
|
|
|
SetOutPath "$INSTDIR"
|
|
|
|
File "${NSISDIR}\Contrib\UIs\modern.exe"
|
2002-10-26 22:09:54 +00:00
|
|
|
|
|
|
|
;Read a value from an Install Options INI File
|
|
|
|
!insertmacro MUI_INSTALLOPTIONS_READ ${TEMP1} "ioC.ini" "Field 2" "State"
|
|
|
|
StrCmp ${TEMP1} "1" "" +2
|
|
|
|
;Checked
|
|
|
|
MessageBox MB_OK "A MessageBox..."
|
2002-09-20 23:02:38 +00:00
|
|
|
|
|
|
|
SectionEnd
|
|
|
|
|
|
|
|
Section "Create uninstaller" SecCreateUninst
|
|
|
|
|
|
|
|
;Add your stuff here
|
|
|
|
|
|
|
|
WriteUninstaller "$INSTDIR\Uninstall.exe"
|
|
|
|
|
|
|
|
SectionEnd
|
|
|
|
|
|
|
|
Section ""
|
|
|
|
|
|
|
|
;Invisible section to display the Finish header
|
2002-10-26 12:25:02 +00:00
|
|
|
!insertmacro MUI_FINISHHEADER
|
2002-09-20 23:02:38 +00:00
|
|
|
|
|
|
|
SectionEnd
|
|
|
|
|
|
|
|
;--------------------------------
|
|
|
|
;Installer Functions
|
|
|
|
|
|
|
|
Function .onInitDialog
|
2002-10-08 18:06:36 +00:00
|
|
|
|
2002-10-07 19:59:01 +00:00
|
|
|
!insertmacro MUI_INNERDIALOG_INIT
|
2002-09-20 23:02:38 +00:00
|
|
|
|
|
|
|
!insertmacro MUI_INNERDIALOG_START 1
|
2002-10-07 19:59:01 +00:00
|
|
|
!insertmacro MUI_INNERDIALOG_TEXT 1040 $(MUI_INNERTEXT_LICENSE)
|
2002-09-20 23:02:38 +00:00
|
|
|
!insertmacro MUI_INNERDIALOG_STOP 1
|
|
|
|
|
2002-09-22 11:35:10 +00:00
|
|
|
!insertmacro MUI_INNERDIALOG_START 4
|
2002-10-07 19:59:01 +00:00
|
|
|
!insertmacro MUI_INNERDIALOG_TEXT 1042 $(MUI_INNERTEXT_DESCRIPTION_TITLE)
|
|
|
|
!insertmacro MUI_INNERDIALOG_TEXT 1043 $(MUI_INNERTEXT_DESCRIPTION_INFO)
|
2002-09-22 11:35:10 +00:00
|
|
|
!insertmacro MUI_INNERDIALOG_STOP 4
|
2002-09-20 23:02:38 +00:00
|
|
|
|
2002-09-22 11:35:10 +00:00
|
|
|
!insertmacro MUI_INNERDIALOG_START 5
|
2002-10-07 19:59:01 +00:00
|
|
|
!insertmacro MUI_INNERDIALOG_TEXT 1041 $(MUI_INNERTEXT_DESTINATIONFOLDER)
|
|
|
|
!insertmacro MUI_INNERDIALOG_STOP 5
|
2002-09-20 23:02:38 +00:00
|
|
|
|
|
|
|
!insertmacro MUI_INNERDIALOG_END
|
2002-10-08 18:06:36 +00:00
|
|
|
|
2002-09-20 23:02:38 +00:00
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
Function .onNextPage
|
2002-10-08 18:06:36 +00:00
|
|
|
|
2002-09-22 11:58:04 +00:00
|
|
|
!insertmacro MUI_INSTALLOPTIONS_NEXTPAGE
|
2002-10-26 12:25:02 +00:00
|
|
|
!insertmacro MUI_NEXTPAGE
|
2002-10-08 18:06:36 +00:00
|
|
|
|
2002-09-20 23:02:38 +00:00
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
Function .onPrevPage
|
2002-10-08 18:06:36 +00:00
|
|
|
|
2002-09-22 11:58:04 +00:00
|
|
|
!insertmacro MUI_INSTALLOPTIONS_PREVPAGE
|
2002-10-26 12:25:02 +00:00
|
|
|
!insertmacro MUI_PREVPAGE
|
2002-10-08 18:06:36 +00:00
|
|
|
|
2002-09-20 23:02:38 +00:00
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
Function SetPage
|
|
|
|
|
|
|
|
!insertmacro MUI_PAGE_INIT
|
|
|
|
|
|
|
|
!insertmacro MUI_PAGE_START 1
|
2002-10-07 19:59:01 +00:00
|
|
|
!insertmacro MUI_HEADER_TEXT $(MUI_TEXT_LICENSE_TITLE) $(MUI_TEXT_LICENSE_SUBTITLE)
|
2002-09-20 23:02:38 +00:00
|
|
|
!insertmacro MUI_PAGE_STOP 1
|
|
|
|
|
|
|
|
!insertmacro MUI_PAGE_START 2
|
2002-10-07 19:59:01 +00:00
|
|
|
!insertmacro MUI_HEADER_TEXT $(MUI_TEXT_IO_TITLE) $(MUI_TEXT_IO_SUBTITLE)
|
2002-10-26 22:09:54 +00:00
|
|
|
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioA.ini" "Settings" "Title" "${NAME} ${VERSION} Setup: Install Options A"
|
|
|
|
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioA.ini" "Settings" "CancelConfirm" "Are you sure you want to quit ${NAME} Setup?"
|
|
|
|
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioA.ini" "Settings" "CancelConfirmCaption" "${NAME} ${VERSION} Setup"
|
|
|
|
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioA.ini" "Settings" "CancelConfirmFlags" "MB_ICONEXCLAMATION"
|
|
|
|
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioA.ini" "Settings" "BackButtonText" $(MUI_BUTTONTEXT_BACK)
|
|
|
|
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioA.ini" "Settings" "NextButtonText" $(MUI_BUTTONTEXT_NEXT)
|
2002-10-07 19:59:01 +00:00
|
|
|
!insertmacro MUI_INSTALLOPTIONS_SHOW 2 "ioA.ini" "" "IO" ;Next page is an IO page
|
2002-09-20 23:02:38 +00:00
|
|
|
!insertmacro MUI_PAGE_STOP 2
|
2002-10-07 19:59:01 +00:00
|
|
|
|
2002-09-20 23:02:38 +00:00
|
|
|
!insertmacro MUI_PAGE_START 3
|
2002-10-07 19:59:01 +00:00
|
|
|
!insertmacro MUI_HEADER_TEXT $(MUI_TEXT_IO_TITLE) $(MUI_TEXT_IO_SUBTITLE)
|
2002-10-26 22:09:54 +00:00
|
|
|
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioB.ini" "Settings" "Title" "${NAME} ${VERSION} Setup: Install Options B"
|
|
|
|
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioB.ini" "Settings" "CancelConfirm" "Are you sure you want to quit ${NAME} Setup?"
|
|
|
|
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioB.ini" "Settings" "CancelConfirmCaption" "${NAME} ${VERSION} Setup"
|
|
|
|
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioB.ini" "Settings" "CancelConfirmFlags" "MB_ICONEXCLAMATION"
|
|
|
|
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioB.ini" "Settings" "BackButtonText" $(MUI_BUTTONTEXT_BACK)
|
|
|
|
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioB.ini" "Settings" "NextButtonText" $(MUI_BUTTONTEXT_NEXT)
|
2002-10-07 19:59:01 +00:00
|
|
|
!insertmacro MUI_INSTALLOPTIONS_SHOW 3 "ioB.ini" "IO" "" ;Previous page is an IO page
|
2002-09-20 23:02:38 +00:00
|
|
|
!insertmacro MUI_PAGE_STOP 3
|
|
|
|
|
|
|
|
!insertmacro MUI_PAGE_START 4
|
2002-10-07 19:59:01 +00:00
|
|
|
!insertmacro MUI_HEADER_TEXT $(MUI_TEXT_COMPONENTS_TITLE) $(MUI_TEXT_COMPONENTS_SUBTITLE)
|
2002-09-20 23:02:38 +00:00
|
|
|
!insertmacro MUI_PAGE_STOP 4
|
|
|
|
|
|
|
|
!insertmacro MUI_PAGE_START 5
|
2002-10-07 19:59:01 +00:00
|
|
|
!insertmacro MUI_HEADER_TEXT $(MUI_TEXT_DIRSELECT_TITLE) $(MUI_TEXT_DIRSELECT_SUBTITLE)
|
2002-09-20 23:02:38 +00:00
|
|
|
!insertmacro MUI_PAGE_STOP 5
|
|
|
|
|
|
|
|
!insertmacro MUI_PAGE_START 6
|
2002-10-07 19:59:01 +00:00
|
|
|
!insertmacro MUI_HEADER_TEXT $(MUI_TEXT_IO_TITLE) $(MUI_TEXT_IO_SUBTITLE)
|
2002-10-26 22:09:54 +00:00
|
|
|
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioC.ini" "Settings" "Title" "${NAME} ${VERSION} Setup: Install Options C"
|
|
|
|
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioC.ini" "Settings" "CancelConfirm" "Are you sure you want to quit ${NAME} Setup?"
|
|
|
|
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioC.ini" "Settings" "CancelConfirmCaption" "${NAME} ${VERSION} Setup"
|
|
|
|
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioC.ini" "Settings" "CancelConfirmFlags" "MB_ICONEXCLAMATION"
|
|
|
|
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioC.ini" "Settings" "BackButtonText" $(MUI_BUTTONTEXT_BACK)
|
|
|
|
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioC.ini" "Settings" "NextButtonText" $(MUI_BUTTONTEXT_INSTALL)
|
|
|
|
!insertmacro MUI_INSTALLOPTIONS_SHOW 6 "ioC.ini" "" "" ;Next/previous pages are no IO pages
|
2002-09-20 23:02:38 +00:00
|
|
|
!insertmacro MUI_PAGE_STOP 6
|
|
|
|
|
|
|
|
!insertmacro MUI_PAGE_START 7
|
2002-10-07 19:59:01 +00:00
|
|
|
!insertmacro MUI_HEADER_TEXT $(MUI_TEXT_INSTALLING_TITLE) $(MUI_TEXT_INSTALLING_SUBTITLE)
|
2002-09-20 23:02:38 +00:00
|
|
|
!insertmacro MUI_PAGE_STOP 7
|
|
|
|
|
2002-09-22 11:35:10 +00:00
|
|
|
!insertmacro MUI_PAGE_START 8
|
2002-10-07 19:59:01 +00:00
|
|
|
!insertmacro MUI_HEADER_TEXT $(MUI_TEXT_FINISHED_TITLE) $(MUI_TEXT_FINISHED_SUBTITLE)
|
2002-09-22 11:35:10 +00:00
|
|
|
!insertmacro MUI_PAGE_STOP 8
|
|
|
|
|
2002-10-07 19:59:01 +00:00
|
|
|
!insertmacro MUI_PAGE_END
|
2002-09-20 23:02:38 +00:00
|
|
|
|
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
Function .onMouseOverSection
|
|
|
|
|
|
|
|
!insertmacro MUI_DESCRIPTION_INIT
|
|
|
|
|
2002-10-07 19:59:01 +00:00
|
|
|
!insertmacro MUI_DESCRIPTION_TEXT ${SecCopyUI} $(DESC_SecCopyUI)
|
|
|
|
!insertmacro MUI_DESCRIPTION_TEXT ${SecCreateUninst} $(DESC_SecCreateUninst)
|
2002-09-20 23:02:38 +00:00
|
|
|
|
|
|
|
!insertmacro MUI_DESCRIPTION_END
|
|
|
|
|
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
Function .onUserAbort
|
|
|
|
|
2002-10-07 19:59:01 +00:00
|
|
|
!insertmacro MUI_ABORTWARNING
|
2002-09-20 23:02:38 +00:00
|
|
|
|
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
;--------------------------------
|
|
|
|
;Uninstaller Section
|
|
|
|
|
|
|
|
Section "Uninstall"
|
|
|
|
|
|
|
|
;Add your stuff here
|
|
|
|
|
|
|
|
Delete "$INSTDIR\modern.exe"
|
|
|
|
Delete "$INSTDIR\Uninstall.exe"
|
|
|
|
|
|
|
|
RMDir "$INSTDIR"
|
|
|
|
|
2002-10-26 12:25:02 +00:00
|
|
|
!insertmacro MUI_UNFINISHHEADER
|
2002-09-20 23:02:38 +00:00
|
|
|
|
|
|
|
SectionEnd
|
|
|
|
|
|
|
|
;--------------------------------
|
|
|
|
;Uninstaller Functions
|
|
|
|
|
|
|
|
Function un.onNextPage
|
2002-10-26 12:25:02 +00:00
|
|
|
|
2002-10-07 19:59:01 +00:00
|
|
|
!insertmacro MUI_INSTALLOPTIONS_NEXTPAGE
|
2002-10-26 12:25:02 +00:00
|
|
|
!insertmacro MUI_UNNEXTPAGE
|
|
|
|
|
2002-09-20 23:02:38 +00:00
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
Function un.SetPage
|
2002-10-07 19:59:01 +00:00
|
|
|
|
2002-09-20 23:02:38 +00:00
|
|
|
!insertmacro MUI_PAGE_INIT
|
2002-10-07 19:59:01 +00:00
|
|
|
|
2002-09-20 23:02:38 +00:00
|
|
|
!insertmacro MUI_PAGE_START 1
|
2002-10-07 19:59:01 +00:00
|
|
|
!insertmacro MUI_HEADER_TEXT $(MUI_UNTEXT_INTRO_TITLE) $(MUI_UNTEXT_INTRO_SUBTITLE)
|
2002-09-20 23:02:38 +00:00
|
|
|
!insertmacro MUI_PAGE_STOP 1
|
|
|
|
|
|
|
|
!insertmacro MUI_PAGE_START 2
|
2002-10-07 19:59:01 +00:00
|
|
|
!insertmacro MUI_HEADER_TEXT $(MUI_UNTEXT_UNINSTALLING_TITLE) $(MUI_UNTEXT_UNINSTALLING_SUBTITLE)
|
2002-09-20 23:02:38 +00:00
|
|
|
!insertmacro MUI_PAGE_STOP 2
|
|
|
|
|
|
|
|
!insertmacro MUI_PAGE_START 3
|
2002-10-07 19:59:01 +00:00
|
|
|
!insertmacro MUI_HEADER_TEXT $(MUI_UNTEXT_FINISHED_TITLE) $(MUI_UNTEXT_FINISHED_SUBTITLE)
|
2002-09-20 23:02:38 +00:00
|
|
|
!insertmacro MUI_PAGE_STOP 3
|
|
|
|
|
|
|
|
!insertmacro MUI_PAGE_END
|
|
|
|
|
|
|
|
FunctionEnd
|
|
|
|
|
2002-10-07 19:59:01 +00:00
|
|
|
;eof
|