diff --git a/Examples/Modern UI/Basic.nsi b/Examples/Modern UI/Basic.nsi new file mode 100644 index 00000000..51c57bb8 --- /dev/null +++ b/Examples/Modern UI/Basic.nsi @@ -0,0 +1,189 @@ +;NSIS Modern UI version 1.3 +;Basic Example Script +;Written by Joost Verburg + +!define NAME "Test Software" ;Define your own software name here +!define VERSION "1.0" ;Define your own software version here + +!verbose 3 + !include "${NSISDIR}\Contrib\Modern UI\System.nsh" +!verbose 4 + +;-------------------------------- +;Configuration + + ;Language + ;English + LoadLanguageFile "${NSISDIR}\Contrib\Language files\English.nlf" + !include "${NSISDIR}\Contrib\Modern UI\English.nsh" + + ;General + Name "${NAME} ${VERSION}" + OutFile "Basic.exe" + + ;User interface - icons, ui file, check bitmap, progress bar etc. + !insertmacro MUI_INTERFACE "modern.exe" "adni18-installer-C-no48xp.ico" "adni18-uninstall-C-no48xp.ico" "modern.bmp" "smooth" "$9" ;$9 is the variable used to store the current page, do not use this var! + + ;License dialog + !insertmacro MUI_ENGLISH_LICENSETEXT + LicenseData "License.txt" + + ;Component-select dialog + !insertmacro MUI_ENGLISH_COMPONENTTEXT + ;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}." + + ;Folder-select dialog + !insertmacro MUI_ENGLISH_DIRTEXT + InstallDir "$PROGRAMFILES\${NAME}" + + ;Uninstaller + !insertmacro MUI_ENGLISH_UNINSTALLTEXT + +;-------------------------------- +;Installer Sections + +Section "modern.exe" SecCopyUI + + ;Add your stuff here + + SetOutPath "$INSTDIR" + File "${NSISDIR}\Contrib\UIs\modern.exe" + +SectionEnd + +Section "Create uninstaller" SecCreateUninst + + ;Add your stuff here + + WriteUninstaller "$INSTDIR\Uninstall.exe" + +SectionEnd + +Section "" + + ;Invisible section to display the Finish header + !insertmacro MUI_FINISHHEADER SetPage + +SectionEnd + +;-------------------------------- +;Installer Functions + +Function .onInitDialog + !insertmacro MUI_INNERDIALOG_INIT + + !insertmacro MUI_INNERDIALOG_START 1 + !insertmacro MUI_INNERDIALOG_TEXT 1040 $(MUI_INNERTEXT_LICENSE) + !insertmacro MUI_INNERDIALOG_STOP 1 + + !insertmacro MUI_INNERDIALOG_START 2 + !insertmacro MUI_INNERDIALOG_TEXT 1042 $(MUI_INNERTEXT_DESCRIPTION_TITLE) + !insertmacro MUI_INNERDIALOG_TEXT 1043 $(MUI_INNERTEXT_DESCRIPTION_INFO) + !insertmacro MUI_INNERDIALOG_STOP 2 + + !insertmacro MUI_INNERDIALOG_START 3 + !insertmacro MUI_INNERDIALOG_TEXT 1041 $(MUI_INNERTEXT_DESTINATIONFOLDER) + !insertmacro MUI_INNERDIALOG_STOP 3 + + !insertmacro MUI_INNERDIALOG_END +FunctionEnd + +Function .onNextPage + !insertmacro MUI_NEXTPAGE SetPage +FunctionEnd + +Function .onPrevPage + !insertmacro MUI_PREVPAGE SetPage +FunctionEnd + +Function SetPage + + !insertmacro MUI_PAGE_INIT + + !insertmacro MUI_PAGE_START 1 + !insertmacro MUI_HEADER_TEXT $(MUI_TEXT_LICENSE_TITLE) $(MUI_TEXT_LICENSE_SUBTITLE) + !insertmacro MUI_PAGE_STOP 1 + + !insertmacro MUI_PAGE_START 2 + !insertmacro MUI_HEADER_TEXT $(MUI_TEXT_COMPONENTS_TITLE) $(MUI_TEXT_COMPONENTS_SUBTITLE) + !insertmacro MUI_PAGE_STOP 2 + + !insertmacro MUI_PAGE_START 3 + !insertmacro MUI_HEADER_TEXT $(MUI_TEXT_DIRSELECT_TITLE) $(MUI_TEXT_DIRSELECT_SUBTITLE) + !insertmacro MUI_PAGE_STOP 3 + + !insertmacro MUI_PAGE_START 4 + !insertmacro MUI_HEADER_TEXT $(MUI_TEXT_INSTALLING_TITLE) $(MUI_TEXT_INSTALLING_SUBTITLE) + !insertmacro MUI_PAGE_STOP 4 + + !insertmacro MUI_PAGE_START 5 + !insertmacro MUI_HEADER_TEXT $(MUI_TEXT_FINISHED_TITLE) $(MUI_TEXT_FINISHED_SUBTITLE) + !insertmacro MUI_PAGE_STOP 5 + + !insertmacro MUI_PAGE_END + +FunctionEnd + +Function .onMouseOverSection + + !insertmacro MUI_DESCRIPTION_INIT + + !insertmacro MUI_DESCRIPTION_TEXT ${SecCopyUI} $(DESC_SecCopyUI) + !insertmacro MUI_DESCRIPTION_TEXT ${SecCreateUninst} $(DESC_SecCreateUninst) + + !insertmacro MUI_DESCRIPTION_END + +FunctionEnd + +Function .onUserAbort + + !insertmacro MUI_ABORTWARNING + +FunctionEnd + +;-------------------------------- +;Uninstaller Section + +Section "Uninstall" + + ;Add your stuff here + + Delete "$INSTDIR\modern.exe" + Delete "$INSTDIR\Uninstall.exe" + + RMDir "$INSTDIR" + + !insertmacro MUI_FINISHHEADER un.SetPage + +SectionEnd + +;-------------------------------- +;Uninstaller Functions + +Function un.onNextPage + !insertmacro MUI_NEXTPAGE un.onNextPage +FunctionEnd + +Function un.SetPage + + !insertmacro MUI_PAGE_INIT + + !insertmacro MUI_PAGE_START 1 + !insertmacro MUI_HEADER_TEXT $(MUI_UNTEXT_INTRO_TITLE) $(MUI_UNTEXT_INTRO_SUBTITLE) + !insertmacro MUI_PAGE_STOP 1 + + !insertmacro MUI_PAGE_START 2 + !insertmacro MUI_HEADER_TEXT $(MUI_UNTEXT_UNINSTALLING_TITLE) $(MUI_UNTEXT_UNINSTALLING_SUBTITLE) + !insertmacro MUI_PAGE_STOP 2 + + !insertmacro MUI_PAGE_START 3 + !insertmacro MUI_HEADER_TEXT $(MUI_UNTEXT_FINISHED_TITLE) $(MUI_UNTEXT_FINISHED_SUBTITLE) + !insertmacro MUI_PAGE_STOP 3 + + !insertmacro MUI_PAGE_END + +FunctionEnd + +;eof \ No newline at end of file diff --git a/Examples/Modern UI/InstallOptions.nsi b/Examples/Modern UI/InstallOptions.nsi index 704a6afb..b9a17173 100644 --- a/Examples/Modern UI/InstallOptions.nsi +++ b/Examples/Modern UI/InstallOptions.nsi @@ -1,52 +1,72 @@ -;NSIS Modern Style UI version 1.21 -;InstallOptions Example Script +;NSIS Modern UI version 1.3 +;Install Options Example Script ;Written by Joost Verburg !define NAME "Test Software" ;Define your own software name here !define VERSION "1.0" ;Define your own software version here !verbose 3 - !include "ModernUI.nsh" + !include "${NSISDIR}\Contrib\Modern UI\System.nsh" !verbose 4 ;-------------------------------- ;Configuration + ;Language + ;English + LoadLanguageFile "${NSISDIR}\Contrib\Language files\English.nlf" + !include "${NSISDIR}\Contrib\Modern UI\English.nsh" + ;General Name "${NAME} ${VERSION}" OutFile "InstallOptions.exe" - SetOverwrite on - ;User interface + ;User interface - icons, ui file, check bitmap, progress bar etc. !insertmacro MUI_INTERFACE "modern.exe" "adni18-installer-C-no48xp.ico" "adni18-uninstall-C-no48xp.ico" "modern.bmp" "smooth" "$9" ;$9 is the variable used to store the current page, do not use this var! !insertmacro MUI_INSTALLOPTIONS "$7" "$8" ;Variables for the Install Options system. Do not use them in .onNext/PrevPage and SetPage ;License dialog - LicenseText "Press Page Down to see the rest of the agreement." + !insertmacro MUI_ENGLISH_LICENSETEXT LicenseData "License.txt" ;Component-select dialog - ComponentText "Check the components you want to install and uncheck the components you don't want to install. Click Next to continue." + !insertmacro MUI_ENGLISH_COMPONENTTEXT + ;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}." ;Folder-select dialog + !insertmacro MUI_ENGLISH_DIRTEXT InstallDir "$PROGRAMFILES\${NAME}" - DirText "Setup will install ${NAME} in the following folder.$\r$\n$\r$\nTo install in this folder, click Install. To install in a different folder, click Browse and select another folder." " " InstallButtonText "Next >" ;Install Options dialog has 'Install' button + + ;Install Options dialogs + LangString MUI_TEXT_IO_TITLE ${LANG_ENGLISH} "Install Options Page" + LangString MUI_TEXT_IO_SUBTITLE ${LANG_ENGLISH} "Create your own dialog!" ;Uninstaller - UninstallText "This will uninstall ${NAME} from your system." - + !insertmacro MUI_ENGLISH_UNINSTALLTEXT + ;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" - ReserveFile "iniA.ini" - ReserveFile "iniB.ini" - ReserveFile "iniC.ini" + ReserveFile "ioA.ini" + ReserveFile "ioB.ini" + ReserveFile "ioC.ini" ;-------------------------------- ;Installer Sections -Section "Modern.exe" SecCopyUI +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 ;Add your stuff here @@ -73,48 +93,33 @@ SectionEnd ;-------------------------------- ;Installer Functions -Function .onInit - - ;Init InstallOptions - !insertmacro MUI_INSTALLOPTIONS_EXTRACT "iniA.ini" - !insertmacro MUI_INSTALLOPTIONS_EXTRACT "iniB.ini" - !insertmacro MUI_INSTALLOPTIONS_EXTRACT "iniC.ini" - -FunctionEnd - Function .onInitDialog - - !insertmacro MUI_INNERDIALOG_INIT + !insertmacro MUI_INNERDIALOG_INIT !insertmacro MUI_INNERDIALOG_START 1 - !insertmacro MUI_INNERDIALOG_TEXT 1033 1040 "If you accept all the terms of the agreement, choose I Agree to continue. If you choose Cancel, Setup will close. You must accept the agreement to install ${NAME}." + !insertmacro MUI_INNERDIALOG_TEXT 1040 $(MUI_INNERTEXT_LICENSE) !insertmacro MUI_INNERDIALOG_STOP 1 !insertmacro MUI_INNERDIALOG_START 4 - !insertmacro MUI_INNERDIALOG_TEXT 1033 1042 "Description" - !insertmacro MUI_INNERDIALOG_TEXT 1033 1043 "Hover your mouse over a component to see it's description." + !insertmacro MUI_INNERDIALOG_TEXT 1042 $(MUI_INNERTEXT_DESCRIPTION_TITLE) + !insertmacro MUI_INNERDIALOG_TEXT 1043 $(MUI_INNERTEXT_DESCRIPTION_INFO) !insertmacro MUI_INNERDIALOG_STOP 4 !insertmacro MUI_INNERDIALOG_START 5 - !insertmacro MUI_INNERDIALOG_TEXT 1033 1041 "Destination Folder" - !insertmacro MUI_INNERDIALOG_STOP 5 + !insertmacro MUI_INNERDIALOG_TEXT 1041 $(MUI_INNERTEXT_DESTINATIONFOLDER) + !insertmacro MUI_INNERDIALOG_STOP 5 !insertmacro MUI_INNERDIALOG_END - FunctionEnd Function .onNextPage - !insertmacro MUI_INSTALLOPTIONS_NEXTPAGE !insertmacro MUI_NEXTPAGE SetPage - FunctionEnd Function .onPrevPage - !insertmacro MUI_INSTALLOPTIONS_PREVPAGE !insertmacro MUI_PREVPAGE SetPage - FunctionEnd Function SetPage @@ -122,53 +127,59 @@ Function SetPage !insertmacro MUI_PAGE_INIT !insertmacro MUI_PAGE_START 1 - !insertmacro MUI_HEADER_TEXT 1033 "License Agreement" "Please review the license terms before installing ${NAME}." + !insertmacro MUI_HEADER_TEXT $(MUI_TEXT_LICENSE_TITLE) $(MUI_TEXT_LICENSE_SUBTITLE) !insertmacro MUI_PAGE_STOP 1 !insertmacro MUI_PAGE_START 2 - !insertmacro MUI_HEADER_TEXT 1033 "Install Options A" "Create your own dialog!" - WriteIniStr "$PLUGINSDIR\iniA.ini" "Settings" "Title" "${NAME} ${VERSION} Setup: Install Options A" - WriteIniStr "$PLUGINSDIR\iniA.ini" "Settings" "CancelConfirm" "Are you sure you want to quit ${NAME} Setup?" - WriteIniStr "$PLUGINSDIR\iniA.ini" "Settings" "CancelConfirmCaption" "${NAME} ${VERSION} Setup" - WriteIniStr "$PLUGINSDIR\iniA.ini" "Settings" "CancelConfirmFlags" "MB_ICONEXCLAMATION" - !insertmacro MUI_INSTALLOPTIONS_SHOW 2 "iniA.ini" "" "IO" ;Next page is an IO page + !insertmacro MUI_HEADER_TEXT $(MUI_TEXT_IO_TITLE) $(MUI_TEXT_IO_SUBTITLE) + WriteIniStr "$PLUGINSDIR\ioA.ini" "Settings" "Title" "${NAME} ${VERSION} Setup: Install Options A" + WriteIniStr "$PLUGINSDIR\ioA.ini" "Settings" "CancelConfirm" "Are you sure you want to quit ${NAME} Setup?" + WriteIniStr "$PLUGINSDIR\ioA.ini" "Settings" "CancelConfirmCaption" "${NAME} ${VERSION} Setup" + WriteIniStr "$PLUGINSDIR\ioA.ini" "Settings" "CancelConfirmFlags" "MB_ICONEXCLAMATION" + WriteIniStr "$PLUGINSDIR\ioA.ini" "Settings" "BackButtonText" $(MUI_BUTTONTEXT_BACK) + WriteIniStr "$PLUGINSDIR\ioA.ini" "Settings" "NextButtonText" $(MUI_BUTTONTEXT_NEXT) + !insertmacro MUI_INSTALLOPTIONS_SHOW 2 "ioA.ini" "" "IO" ;Next page is an IO page !insertmacro MUI_PAGE_STOP 2 - + !insertmacro MUI_PAGE_START 3 - !insertmacro MUI_HEADER_TEXT 1033 "Install Options B" "Create your own dialog!" - WriteIniStr "$PLUGINSDIR\iniB.ini" "Settings" "Title" "${NAME} ${VERSION} Setup: Install Options B" - WriteIniStr "$PLUGINSDIR\iniB.ini" "Settings" "CancelConfirm" "Are you sure you want to quit ${NAME} Setup?" - WriteIniStr "$PLUGINSDIR\iniB.ini" "Settings" "CancelConfirmCaption" "${NAME} ${VERSION} Setup" - WriteIniStr "$PLUGINSDIR\iniB.ini" "Settings" "CancelConfirmFlags" "MB_ICONEXCLAMATION" - !insertmacro MUI_INSTALLOPTIONS_SHOW 3 "iniB.ini" "IO" "" ;Previous page is an IO page + !insertmacro MUI_HEADER_TEXT $(MUI_TEXT_IO_TITLE) $(MUI_TEXT_IO_SUBTITLE) + WriteIniStr "$PLUGINSDIR\ioB.ini" "Settings" "Title" "${NAME} ${VERSION} Setup: Install Options B" + WriteIniStr "$PLUGINSDIR\ioB.ini" "Settings" "CancelConfirm" "Are you sure you want to quit ${NAME} Setup?" + WriteIniStr "$PLUGINSDIR\ioB.ini" "Settings" "CancelConfirmCaption" "${NAME} ${VERSION} Setup" + WriteIniStr "$PLUGINSDIR\ioB.ini" "Settings" "CancelConfirmFlags" "MB_ICONEXCLAMATION" + WriteIniStr "$PLUGINSDIR\ioB.ini" "Settings" "BackButtonText" $(MUI_BUTTONTEXT_BACK) + WriteIniStr "$PLUGINSDIR\ioB.ini" "Settings" "NextButtonText" $(MUI_BUTTONTEXT_NEXT) + !insertmacro MUI_INSTALLOPTIONS_SHOW 3 "ioB.ini" "IO" "" ;Previous page is an IO page !insertmacro MUI_PAGE_STOP 3 !insertmacro MUI_PAGE_START 4 - !insertmacro MUI_HEADER_TEXT 1033 "Choose Components" "Choose the components you want to install." + !insertmacro MUI_HEADER_TEXT $(MUI_TEXT_COMPONENTS_TITLE) $(MUI_TEXT_COMPONENTS_SUBTITLE) !insertmacro MUI_PAGE_STOP 4 !insertmacro MUI_PAGE_START 5 - !insertmacro MUI_HEADER_TEXT 1033 "Choose Install Location" "Choose the folder in which to install ${NAME}." + !insertmacro MUI_HEADER_TEXT $(MUI_TEXT_DIRSELECT_TITLE) $(MUI_TEXT_DIRSELECT_SUBTITLE) !insertmacro MUI_PAGE_STOP 5 !insertmacro MUI_PAGE_START 6 - !insertmacro MUI_HEADER_TEXT 1033 "Install Options C" "Create your own dialog!" - WriteIniStr "$PLUGINSDIR\iniC.ini" "Settings" "Title" "${NAME} ${VERSION} Setup: Install Options C" - WriteIniStr "$PLUGINSDIR\iniC.ini" "Settings" "CancelConfirm" "Are you sure you want to quit ${NAME} Setup?" - WriteIniStr "$PLUGINSDIR\iniC.ini" "Settings" "CancelConfirmCaption" "${NAME} ${VERSION} Setup" - WriteIniStr "$PLUGINSDIR\iniC.ini" "Settings" "CancelConfirmFlags" "MB_ICONEXCLAMATION" - !insertmacro MUI_INSTALLOPTIONS_SHOW 6 "iniC.ini" "" "" ;Next/previous page is no IO page + !insertmacro MUI_HEADER_TEXT $(MUI_TEXT_IO_TITLE) $(MUI_TEXT_IO_SUBTITLE) + WriteIniStr "$PLUGINSDIR\ioC.ini" "Settings" "Title" "${NAME} ${VERSION} Setup: Install Options C" + WriteIniStr "$PLUGINSDIR\ioC.ini" "Settings" "CancelConfirm" "Are you sure you want to quit ${NAME} Setup?" + WriteIniStr "$PLUGINSDIR\ioC.ini" "Settings" "CancelConfirmCaption" "${NAME} ${VERSION} Setup" + WriteIniStr "$PLUGINSDIR\ioC.ini" "Settings" "CancelConfirmFlags" "MB_ICONEXCLAMATION" + WriteIniStr "$PLUGINSDIR\ioC.ini" "Settings" "BackButtonText" $(MUI_BUTTONTEXT_BACK) + WriteIniStr "$PLUGINSDIR\ioC.ini" "Settings" "NextButtonText" $(MUI_BUTTONTEXT_INSTALL) + !insertmacro MUI_INSTALLOPTIONS_SHOW 6 "ioC.ini" "" "" ;Next/previous pages are NO IO pages !insertmacro MUI_PAGE_STOP 6 !insertmacro MUI_PAGE_START 7 - !insertmacro MUI_HEADER_TEXT 1033 "Installing" "Please wait while ${NAME} is being installed." + !insertmacro MUI_HEADER_TEXT $(MUI_TEXT_INSTALLING_TITLE) $(MUI_TEXT_INSTALLING_SUBTITLE) !insertmacro MUI_PAGE_STOP 7 !insertmacro MUI_PAGE_START 8 - !insertmacro MUI_HEADER_TEXT 1033 "Finished" "Setup was completed successfully." + !insertmacro MUI_HEADER_TEXT $(MUI_TEXT_FINISHED_TITLE) $(MUI_TEXT_FINISHED_SUBTITLE) !insertmacro MUI_PAGE_STOP 8 - !insertmacro MUI_PAGE_END + !insertmacro MUI_PAGE_END FunctionEnd @@ -176,8 +187,8 @@ Function .onMouseOverSection !insertmacro MUI_DESCRIPTION_INIT - !insertmacro MUI_DESCRIPTION_TEXT 1033 ${SecCopyUI} "Copy the modern.exe file to the application folder." - !insertmacro MUI_DESCRIPTION_TEXT 1033 ${SecCreateUninst} "Create a uninstaller which can automatically delete ${NAME}." + !insertmacro MUI_DESCRIPTION_TEXT ${SecCopyUI} $(DESC_SecCopyUI) + !insertmacro MUI_DESCRIPTION_TEXT ${SecCreateUninst} $(DESC_SecCreateUninst) !insertmacro MUI_DESCRIPTION_END @@ -185,8 +196,7 @@ FunctionEnd Function .onUserAbort - !insertmacro MUI_ABORTWARNING 1033 "Are you sure you want to quit ${NAME} Setup?" - !insertmacro MUI_ABORTWARNING_END + !insertmacro MUI_ABORTWARNING FunctionEnd @@ -210,29 +220,28 @@ SectionEnd ;Uninstaller Functions Function un.onNextPage - - !insertmacro MUI_NEXTPAGE un.SetPage - + !insertmacro MUI_INSTALLOPTIONS_NEXTPAGE + !insertmacro MUI_NEXTPAGE un.onNextPage FunctionEnd Function un.SetPage - + !insertmacro MUI_PAGE_INIT - + !insertmacro MUI_PAGE_START 1 - !insertmacro MUI_HEADER_TEXT 1033 "Uninstall ${NAME}" "Remove ${NAME} from your system." + !insertmacro MUI_HEADER_TEXT $(MUI_UNTEXT_INTRO_TITLE) $(MUI_UNTEXT_INTRO_SUBTITLE) !insertmacro MUI_PAGE_STOP 1 !insertmacro MUI_PAGE_START 2 - !insertmacro MUI_HEADER_TEXT 1033 "Uninstalling" "Please wait while ${NAME} is being uninstalled." + !insertmacro MUI_HEADER_TEXT $(MUI_UNTEXT_UNINSTALLING_TITLE) $(MUI_UNTEXT_UNINSTALLING_SUBTITLE) !insertmacro MUI_PAGE_STOP 2 !insertmacro MUI_PAGE_START 3 - !insertmacro MUI_HEADER_TEXT 1033 "Finished" "${NAME} has been removed from your system." + !insertmacro MUI_HEADER_TEXT $(MUI_UNTEXT_FINISHED_TITLE) $(MUI_UNTEXT_FINISHED_SUBTITLE) !insertmacro MUI_PAGE_STOP 3 !insertmacro MUI_PAGE_END FunctionEnd -;eof +;eof \ No newline at end of file diff --git a/Examples/Modern UI/MultiLanguage.nsi b/Examples/Modern UI/MultiLanguage.nsi index d8bc4f21..348d4fe2 100644 --- a/Examples/Modern UI/MultiLanguage.nsi +++ b/Examples/Modern UI/MultiLanguage.nsi @@ -1,58 +1,67 @@ -;NSIS Modern Style UI version 1.21 -;Multilanguage & LangDLL Example Script +;NSIS Modern UI version 1.3 +;MultiLanguage & LangDLL Example Script ;Written by Joost Verburg !define NAME "Test Software" ;Define your own software name here !define VERSION "1.0" ;Define your own software version here !verbose 3 - !include "ModernUI.nsh" + !include "${NSISDIR}\Contrib\Modern UI\System.nsh" !verbose 4 ;-------------------------------- ;Configuration - ;Language Files - LoadLanguageFile "${NSISDIR}\Contrib\Language files\English.nlf" - LoadLanguageFile "${NSISDIR}\Contrib\Language files\Dutch.nlf" + ;Language + ;English + LoadLanguageFile "${NSISDIR}\Contrib\Language files\English.nlf" + !include "${NSISDIR}\Contrib\Modern UI\English.nsh" + + ;Dutch + LoadLanguageFile "${NSISDIR}\Contrib\Language files\Dutch.nlf" + !include "${NSISDIR}\Contrib\Modern UI\Dutch.nsh" ;General Name /LANG=${LANG_ENGLISH} "${NAME} ${VERSION}" Name /LANG=${LANG_DUTCH} "${NAME} ${VERSION}" - OutFile "Multilanguage.exe" - SetOverwrite on + OutFile "MultiLanguage.exe" - ;User interface + ;User interface - icons, ui file, check bitmap, progress bar etc. !insertmacro MUI_INTERFACE "modern.exe" "adni18-installer-C-no48xp.ico" "adni18-uninstall-C-no48xp.ico" "modern.bmp" "smooth" "$9" ;$9 is the variable used to store the current page, do not use this var! ;License dialog - LicenseText /LANG=${LANG_ENGLISH} "Press Page Down to see the rest of the agreement." - LicenseText /LANG=${LANG_DUTCH} "Druk op Page Down om de rest van de overeenkomt te zien." + !insertmacro MUI_ENGLISH_LICENSETEXT + !insertmacro MUI_DUTCH_LICENSETEXT LicenseData /LANG=${LANG_ENGLISH} "License.txt" LicenseData /LANG=${LANG_DUTCH} "License.txt" ;Component-select dialog - ComponentText /LANG=${LANG_ENGLISH} "Check the components you want to install and uncheck the components you don't want to install. Click Next to continue." - ComponentText /LANG=${LANG_DUTCH} "Selecteer de onderdelen die u wilt installer en deselecteer de onderdelen die u niet wilt installeren. Klik Volgende om verder te gaan." - LangString SecCreateUninstName ${LANG_ENGLISH} "Uninstaller" - LangString SecCreateUninstName ${LANG_DUTCH} "Deïnstallatie programma" + !insertmacro MUI_ENGLISH_COMPONENTTEXT + !insertmacro MUI_DUTCH_COMPONENTTEXT + ;Titles + LangString TITLE_SecCopyUI ${LANG_ENGLISH} "modern.exe" + LangString TITLE_SecCopyUI ${LANG_DUTCH} "modern.exe" + LangString TITLE_SecCreateUninst ${LANG_ENGLISH} "Uninstaller" + LangString TITLE_SecCreateUninst ${LANG_DUTCH} "Deïnstallatie programma" + ;Descriptions + LangString DESC_SecCopyUI ${LANG_ENGLISH} "Copy the modern.exe file to the application folder." + LangString DESC_SecCopyUI ${LANG_DUTCH} "Kopieër modern.exe naar de programma map." + LangString DESC_SecCreateUninst ${LANG_ENGLISH} "Create a uninstaller which can automatically delete ${NAME}." + LangString DESC_SecCreateUninst ${LANG_DUTCH} "Maak een deïnstallatie programma dat ${NAME} automatisch kan verwijderen." ;Folder-select dialog + !insertmacro MUI_ENGLISH_DIRTEXT + !insertmacro MUI_DUTCH_DIRTEXT InstallDir "$PROGRAMFILES\${NAME}" - DirText /LANG=${LANG_ENGLISH} "Setup will install ${NAME} in the following folder.$\r$\n$\r$\nTo install in this folder, click Install. To install in a different folder, click Browse and select another folder." " " - DirText /LANG=${LANG_DUTCH} "Setup zal ${NAME} in de volgende map installeren.$\r$\n$\r$\nOm in een deze map te intalleren, klik Installeer. Om in een andere map te installeren, klik Bladeren en selecteerd een andere map." " " ;Uninstaller - UninstallText /LANG=${LANG_ENGLISH} "This will uninstall ${NAME} from your system." - UninstallText /LANG=${LANG_DUTCH} "Dit programma zal ${NAME} verwijderen van uw systeem." - - ;Things that need to be extracted on startup (keep these lines before any File command!) - ReserveFile "${NSISDIR}\Plugins\LangDLL.dll" + !insertmacro MUI_ENGLISH_UNINSTALLTEXT + !insertmacro MUI_DUTCH_UNINSTALLTEXT ;-------------------------------- ;Installer Sections -Section "modern.exe" SecCopyUI +Section $(TITLE_SecCopyUI) SecCopyUI ;Add your stuff here @@ -61,10 +70,7 @@ Section "modern.exe" SecCopyUI SectionEnd -Section $(SecCreateUninstName) SecCreateUninst - - ;Write the language to the registry (for the uninstaller) - WriteRegStr HKCU "Software\${NAME}" "Installer Language" "$LANGUAGE" +Section $(TITLE_SecCreateUninst) SecCreateUninst ;Add your stuff here @@ -93,40 +99,30 @@ Function .onInit FunctionEnd Function .onInitDialog - - !insertmacro MUI_INNERDIALOG_INIT + !insertmacro MUI_INNERDIALOG_INIT !insertmacro MUI_INNERDIALOG_START 1 - !insertmacro MUI_INNERDIALOG_TEXT ${LANG_ENGLISH} 1040 "If you accept all the terms of the agreement, choose I Agree to continue. If you choose Cancel, Setup will close. You must accept the agreement to install ${NAME}." - !insertmacro MUI_INNERDIALOG_TEXT ${LANG_DUTCH} 1040 "Als u de overeenkomt accepteert, kies Akkoord om verder te gaan. Als u Annuleren kiest zal Setup sluiten. U moet met de overeenkomst acceptren om ${NAME} te installeren." + !insertmacro MUI_INNERDIALOG_TEXT 1040 $(MUI_INNERTEXT_LICENSE) !insertmacro MUI_INNERDIALOG_STOP 1 !insertmacro MUI_INNERDIALOG_START 2 - !insertmacro MUI_INNERDIALOG_TEXT ${LANG_ENGLISH} 1042 "Description" - !insertmacro MUI_INNERDIALOG_TEXT ${LANG_ENGLISH} 1043 "Hover your mouse over a component to see it's description." - !insertmacro MUI_INNERDIALOG_TEXT ${LANG_DUTCH} 1042 "Beschrijving" - !insertmacro MUI_INNERDIALOG_TEXT ${LANG_DUTCH} 1043 "Beweeg uw muis over een onderdeel om een beschrijving te zien." + !insertmacro MUI_INNERDIALOG_TEXT 1042 $(MUI_INNERTEXT_DESCRIPTION_TITLE) + !insertmacro MUI_INNERDIALOG_TEXT 1043 $(MUI_INNERTEXT_DESCRIPTION_INFO) !insertmacro MUI_INNERDIALOG_STOP 2 !insertmacro MUI_INNERDIALOG_START 3 - !insertmacro MUI_INNERDIALOG_TEXT ${LANG_ENGLISH} 1041 "Destination Folder" - !insertmacro MUI_INNERDIALOG_TEXT ${LANG_DUTCH} 1041 "Installatie Map" + !insertmacro MUI_INNERDIALOG_TEXT 1041 $(MUI_INNERTEXT_DESTINATIONFOLDER) !insertmacro MUI_INNERDIALOG_STOP 3 !insertmacro MUI_INNERDIALOG_END - FunctionEnd Function .onNextPage - !insertmacro MUI_NEXTPAGE SetPage - FunctionEnd Function .onPrevPage - !insertmacro MUI_PREVPAGE SetPage - FunctionEnd Function SetPage @@ -134,31 +130,26 @@ Function SetPage !insertmacro MUI_PAGE_INIT !insertmacro MUI_PAGE_START 1 - !insertmacro MUI_HEADER_TEXT ${LANG_ENGLISH} "License Agreement" "Please review the license terms before installing ${NAME}." - !insertmacro MUI_HEADER_TEXT ${LANG_DUTCH} "Licentie Overeenkomst" "Lees de licentie overeenkomst voordat u ${NAME} installeerd." + !insertmacro MUI_HEADER_TEXT $(MUI_TEXT_LICENSE_TITLE) $(MUI_TEXT_LICENSE_SUBTITLE) !insertmacro MUI_PAGE_STOP 1 !insertmacro MUI_PAGE_START 2 - !insertmacro MUI_HEADER_TEXT ${LANG_ENGLISH} "Choose Components" "Choose the components you want to install." - !insertmacro MUI_HEADER_TEXT ${LANG_DUTCH} "Kies Onderdelen" "Kies de onderdelen die u wilt installeren." + !insertmacro MUI_HEADER_TEXT $(MUI_TEXT_COMPONENTS_TITLE) $(MUI_TEXT_COMPONENTS_SUBTITLE) !insertmacro MUI_PAGE_STOP 2 !insertmacro MUI_PAGE_START 3 - !insertmacro MUI_HEADER_TEXT ${LANG_ENGLISH} "Choose Install Location" "Choose the folder in which to install ${NAME}." - !insertmacro MUI_HEADER_TEXT ${LANG_DUTCH} "Kies Installatie Locatie" "Kies de map waarin u ${NAME} in wilt installeren." + !insertmacro MUI_HEADER_TEXT $(MUI_TEXT_DIRSELECT_TITLE) $(MUI_TEXT_DIRSELECT_SUBTITLE) !insertmacro MUI_PAGE_STOP 3 !insertmacro MUI_PAGE_START 4 - !insertmacro MUI_HEADER_TEXT ${LANG_ENGLISH} "Installing" "Please wait while ${NAME} is being installed." - !insertmacro MUI_HEADER_TEXT ${LANG_DUTCH} "Bezig met installeren" "Een ogenblik geduld terwijl ${NAME} wordt geinstalleerd." + !insertmacro MUI_HEADER_TEXT $(MUI_TEXT_INSTALLING_TITLE) $(MUI_TEXT_INSTALLING_SUBTITLE) !insertmacro MUI_PAGE_STOP 4 !insertmacro MUI_PAGE_START 5 - !insertmacro MUI_HEADER_TEXT ${LANG_ENGLISH} "Finished" "Setup was completed successfully." - !insertmacro MUI_HEADER_TEXT ${LANG_DUTCH} "Gereed" "De installatie is succesvol verlopen." + !insertmacro MUI_HEADER_TEXT $(MUI_TEXT_FINISHED_TITLE) $(MUI_TEXT_FINISHED_SUBTITLE) !insertmacro MUI_PAGE_STOP 5 - !insertmacro MUI_PAGE_END + !insertmacro MUI_PAGE_END FunctionEnd @@ -166,21 +157,16 @@ Function .onMouseOverSection !insertmacro MUI_DESCRIPTION_INIT - !insertmacro MUI_DESCRIPTION_TEXT ${LANG_ENGLISH} ${SecCopyUI} "Copy the modern.exe file to the application folder." - !insertmacro MUI_DESCRIPTION_TEXT ${LANG_ENGLISH} ${SecCreateUninst} "Create a uninstaller which can automatically delete ${NAME}." + !insertmacro MUI_DESCRIPTION_TEXT ${SecCopyUI} $(DESC_SecCopyUI) + !insertmacro MUI_DESCRIPTION_TEXT ${SecCreateUninst} $(DESC_SecCreateUninst) - !insertmacro MUI_DESCRIPTION_TEXT ${LANG_DUTCH} ${SecCopyUI} "Kopieër modern.exe naar de programma map." - !insertmacro MUI_DESCRIPTION_TEXT ${LANG_DUTCH} ${SecCreateUninst} "Maak een deïnstallatie programma dat ${NAME} automatisch kan verwijderen." - - !insertmacro MUI_DESCRIPTION_END + !insertmacro MUI_DESCRIPTION_END FunctionEnd Function .onUserAbort - !insertmacro MUI_ABORTWARNING ${LANG_ENGLISH} "Are you sure you want to quit ${NAME} Setup?" - !insertmacro MUI_ABORTWARNING ${LANG_DUTCH} "Weet u zeker dat u ${NAME} Setup wilt afsluiten?" - !insertmacro MUI_ABORTWARNING_END + !insertmacro MUI_ABORTWARNING FunctionEnd @@ -196,10 +182,6 @@ Section "Uninstall" RMDir "$INSTDIR" - ;Security - do not delete anything if ${NAME} is empty - StrCmp "${NAME}" "" +2 - DeleteRegKey HKCU "Software\${NAME}" - !insertmacro MUI_FINISHHEADER un.SetPage SectionEnd @@ -207,46 +189,28 @@ SectionEnd ;-------------------------------- ;Uninstaller Functions -Function un.onInit - - Push ${MUI_TEMP1} - - ;Get the language from the registry (save by uninstaller) - ReadRegStr ${MUI_TEMP1} HKCU "Software\${NAME}" "Installer Language" - StrCmp ${MUI_TEMP1} "" +2 - StrCpy $LANGUAGE ${MUI_TEMP1} - - Pop ${MUI_TEMP1} - -FunctionEnd - Function un.onNextPage - - !insertmacro MUI_NEXTPAGE un.SetPage - + !insertmacro MUI_NEXTPAGE un.onNextPage FunctionEnd Function un.SetPage + + !insertmacro MUI_PAGE_INIT + + !insertmacro MUI_PAGE_START 1 + !insertmacro MUI_HEADER_TEXT $(MUI_UNTEXT_INTRO_TITLE) $(MUI_UNTEXT_INTRO_SUBTITLE) + !insertmacro MUI_PAGE_STOP 1 - !insertmacro MUI_PAGE_INIT - - !insertmacro MUI_PAGE_START 1 - !insertmacro MUI_HEADER_TEXT ${LANG_ENGLISH} "Uninstall ${NAME}" "Remove ${NAME} from your system." - !insertmacro MUI_HEADER_TEXT ${LANG_DUTCH} "Deïnstalleer ${NAME}" "Verwijder ${NAME} van uw system." - !insertmacro MUI_PAGE_STOP 1 - - !insertmacro MUI_PAGE_START 2 - !insertmacro MUI_HEADER_TEXT ${LANG_ENGLISH} "Uninstalling" "Please wait while ${NAME} is being uninstalled." - !insertmacro MUI_HEADER_TEXT ${LANG_DUTCH} "Bezig met deïnstalleren" "Een ogenblik gedult terwijl ${NAME} van uw system wordt verwijderd." - !insertmacro MUI_PAGE_STOP 2 + !insertmacro MUI_PAGE_START 2 + !insertmacro MUI_HEADER_TEXT $(MUI_UNTEXT_UNINSTALLING_TITLE) $(MUI_UNTEXT_UNINSTALLING_SUBTITLE) + !insertmacro MUI_PAGE_STOP 2 !insertmacro MUI_PAGE_START 3 - !insertmacro MUI_HEADER_TEXT ${LANG_ENGLISH} "Finished" "${NAME} has been removed from your system." - !insertmacro MUI_HEADER_TEXT ${LANG_DUTCH} "Gereed" "${NAME} is verwijderd van uw systeem." + !insertmacro MUI_HEADER_TEXT $(MUI_UNTEXT_FINISHED_TITLE) $(MUI_UNTEXT_FINISHED_SUBTITLE) !insertmacro MUI_PAGE_STOP 3 !insertmacro MUI_PAGE_END FunctionEnd -;eof +;eof \ No newline at end of file diff --git a/Examples/Modern UI/Readme.html b/Examples/Modern UI/Readme.html index 96415805..bf8f91e5 100644 --- a/Examples/Modern UI/Readme.html +++ b/Examples/Modern UI/Readme.html @@ -126,6 +126,12 @@ table file and recompile NSIS.

Version history