Readme Page Based on MUI License Page: Difference between revisions
No edit summary |
mNo edit summary |
||
(9 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
{{PageAuthor|Red Wine}} | {{PageAuthor|Red Wine}} | ||
== Description == | == Description == | ||
Shows the user a readme page based on the MUI license page. Use ${ReadmeLanguage} and ${Un.ReadmeLanguage} | '''Shows the user a readme page based on the MUI license page.'''<BR><BR> | ||
Use '''${ReadmeLanguage}''' and '''${Un.ReadmeLanguage}''' to define the strings for individual languages and use<BR> | |||
'''MUI_PAGE_README''' and/or '''MUI_UNPAGE_README''' to show the page, just as you'd show any other MUI page.<BR> | |||
A complete usage example is available below.<BR><BR> | |||
'''Note:'''<BR> | |||
Header is tested and fully compatible with NSIS Modern User Interface (MUI).<BR> | |||
Please don't ask me how to implement the header with 3rd party UIs. | |||
== The Header == | == The Header == | ||
<highlight-nsis> | <highlight-nsis> | ||
# MUI_EXTRAPAGES.nsh | # MUI_EXTRAPAGES.nsh | ||
# By Red Wine Jan 2007 | |||
!verbose push | |||
!verbose 3 | |||
!ifndef _MUI_EXTRAPAGES_NSH | !ifndef _MUI_EXTRAPAGES_NSH | ||
Line 13: | Line 23: | ||
!macro MUI_EXTRAPAGE_README UN ReadmeFile | !macro MUI_EXTRAPAGE_README UN ReadmeFile | ||
!verbose push | |||
!verbose 3 | |||
!define MUI_PAGE_HEADER_TEXT "$(${UN}ReadmeHeader)" | !define MUI_PAGE_HEADER_TEXT "$(${UN}ReadmeHeader)" | ||
!define MUI_PAGE_HEADER_SUBTEXT "$(${UN}ReadmeSubHeader)" | !define MUI_PAGE_HEADER_SUBTEXT "$(${UN}ReadmeSubHeader)" | ||
Line 19: | Line 31: | ||
!define MUI_LICENSEPAGE_BUTTON "$(^NextBtn)" | !define MUI_LICENSEPAGE_BUTTON "$(^NextBtn)" | ||
!insertmacro MUI_${UN}PAGE_LICENSE "${ReadmeFile}" | !insertmacro MUI_${UN}PAGE_LICENSE "${ReadmeFile}" | ||
!verbose pop | |||
!macroend | !macroend | ||
Line 25: | Line 38: | ||
!macro MUI_PAGE_README ReadmeFile | !macro MUI_PAGE_README ReadmeFile | ||
!verbose push | |||
!verbose 3 | |||
${ReadmeRun} "" "${ReadmeFile}" | ${ReadmeRun} "" "${ReadmeFile}" | ||
!verbose pop | |||
!macroend | !macroend | ||
!macro MUI_UNPAGE_README ReadmeFile | !macro MUI_UNPAGE_README ReadmeFile | ||
!verbose push | |||
!verbose 3 | |||
${ReadmeRun} "UN" "${ReadmeFile}" | ${ReadmeRun} "UN" "${ReadmeFile}" | ||
!verbose pop | |||
!macroend | !macroend | ||
!macro ReadmeLangStrings UN MUI_LANG ReadmeHeader ReadmeSubHeader ReadmeTextTop ReadmeTextBottom | !macro ReadmeLangStrings UN MUI_LANG ReadmeHeader ReadmeSubHeader ReadmeTextTop ReadmeTextBottom | ||
!verbose push | |||
!verbose 3 | |||
LangString ${UN}ReadmeHeader ${MUI_LANG} "${ReadmeHeader}" | LangString ${UN}ReadmeHeader ${MUI_LANG} "${ReadmeHeader}" | ||
LangString ${UN}ReadmeSubHeader ${MUI_LANG} "${ReadmeSubHeader}" | LangString ${UN}ReadmeSubHeader ${MUI_LANG} "${ReadmeSubHeader}" | ||
LangString ${UN}ReadmeTextTop ${MUI_LANG} "${ReadmeTextTop}" | LangString ${UN}ReadmeTextTop ${MUI_LANG} "${ReadmeTextTop}" | ||
LangString ${UN}ReadmeTextBottom ${MUI_LANG} "${ReadmeTextBottom}" | LangString ${UN}ReadmeTextBottom ${MUI_LANG} "${ReadmeTextBottom}" | ||
!verbose pop | |||
!macroend | !macroend | ||
!define ReadmeLanguage | !define ReadmeLanguage `!insertmacro ReadmeLangStrings ""` | ||
!define Un.ReadmeLanguage | !define Un.ReadmeLanguage `!insertmacro ReadmeLangStrings "UN"` | ||
!endif | !endif | ||
!endif | !endif | ||
!verbose pop | |||
</highlight-nsis> | </highlight-nsis> | ||
Line 56: | Line 80: | ||
;-------------------------------- | ;-------------------------------- | ||
;Include Modern UI | ;Include Modern UI | ||
!include "MUI.nsh" | |||
;-------------------------------- | |||
;Énclude MUI_EXTRAPAGES header | |||
!include "MUI_EXTRAPAGES.nsh" | !include "MUI_EXTRAPAGES.nsh" | ||
;-------------------------------- | ;-------------------------------- | ||
;General | ;General | ||
;Name and file | ;Name and file | ||
Name "Modern UI Test" | Name "Modern UI Test" | ||
Line 75: | Line 100: | ||
;-------------------------------- | ;-------------------------------- | ||
;Interface Settings | ;Interface Settings | ||
!define MUI_ABORTWARNING | !define MUI_ABORTWARNING | ||
;-------------------------------- | ;-------------------------------- | ||
;Pages | ;Installer Pages | ||
!insertmacro MUI_PAGE_WELCOME | !insertmacro MUI_PAGE_WELCOME | ||
!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt" | !insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt" | ||
;Add the install read me page | |||
!insertmacro MUI_PAGE_README | !insertmacro MUI_PAGE_README "${NSISDIR}\Docs\Modern UI\Changelog.txt" | ||
!insertmacro MUI_PAGE_COMPONENTS | !insertmacro MUI_PAGE_COMPONENTS | ||
Line 91: | Line 115: | ||
!insertmacro MUI_PAGE_FINISH | !insertmacro MUI_PAGE_FINISH | ||
;-------------------------------- | |||
;Uninstaller Pages | |||
!insertmacro MUI_UNPAGE_WELCOME | !insertmacro MUI_UNPAGE_WELCOME | ||
;Add the uninstall read me page | |||
!insertmacro MUI_UNPAGE_README '${NSISDIR}\License.txt' | !insertmacro MUI_UNPAGE_README '${NSISDIR}\License.txt' | ||
Line 102: | Line 128: | ||
;-------------------------------- | ;-------------------------------- | ||
;Languages | ;Languages | ||
;Add 1st language | |||
!insertmacro MUI_LANGUAGE "English" | |||
;Set up install lang strings for 1st lang | |||
; | ${ReadmeLanguage} "${LANG_ENGLISH}" \ | ||
${ReadmeLanguage} | "Read Me" \ | ||
"Please review the following important information." \ | |||
"About $(^name):" \ | |||
"$\n Click on scrollbar arrows or press Page Down to review the entire text." | |||
${Un.ReadmeLanguage} | ;Set up uninstall lang strings for 1st lang | ||
${Un.ReadmeLanguage} "${LANG_ENGLISH}" \ | |||
"Read Me" \ | |||
"Please review the following important Uninstall information." \ | |||
"About $(^name) Uninstall:" \ | |||
"$\n Click on scrollbar arrows or press Page Down to review the entire text." | |||
;Add 2nd language | |||
!insertmacro MUI_LANGUAGE "Greek" | !insertmacro MUI_LANGUAGE "Greek" | ||
;set up install lang strings for second lang | |||
${ReadmeLanguage} "${LANG_GREEK}" \ | |||
"Read Me" \ | |||
"Please review the following important information." \ | |||
"About $(^name):" \ | |||
"$\n Click on scrollbar arrows or press Page Down to review the entire text." | |||
${Un.ReadmeLanguage} | ;set up uninstall lang strings for second lang | ||
${Un.ReadmeLanguage} "${LANG_GREEK}" \ | |||
"Read Me" \ | |||
"Please review the following important Uninstall information." \ | |||
"About $(^name) Uninstall:" \ | |||
"$\n Click on scrollbar arrows or press Page Down to review the entire text." | |||
;-------------------------------- | ;-------------------------------- | ||
;Installer Sections | ;Installer Sections | ||
Section "Dummy Section" SecDummy | Section "Dummy Section" SecDummy | ||
Line 141: | Line 170: | ||
;ADD YOUR OWN FILES HERE... | ;ADD YOUR OWN FILES HERE... | ||
;Store installation folder | ;Store installation folder | ||
WriteRegStr HKCU "Software\Modern UI Test" "" $INSTDIR | WriteRegStr HKCU "Software\Modern UI Test" "" $INSTDIR | ||
Line 152: | Line 181: | ||
;-------------------------------- | ;-------------------------------- | ||
;Descriptions | ;Descriptions | ||
;Language strings | ;Language strings | ||
LangString DESC_SecDummy ${LANG_ENGLISH} "A test section." | LangString DESC_SecDummy ${LANG_ENGLISH} "A test section." | ||
LangString DESC_SecDummy ${LANG_GREEK} "A test section." | |||
;Assign language strings to sections | ;Assign language strings to sections | ||
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN | !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN | ||
Line 163: | Line 192: | ||
;-------------------------------- | ;-------------------------------- | ||
;Uninstaller Section | ;Uninstaller Section | ||
Section "Uninstall" | Section "Uninstall" | ||
Line 177: | Line 205: | ||
;------------------------------- | ;------------------------------- | ||
;Functions | |||
Function .onInit | Function .onInit | ||
Line 191: | Line 219: | ||
</highlight-nsis> | </highlight-nsis> | ||
[[Category: | == License == | ||
This header file is provided 'as-is', without any express or implied | |||
warranty. In no event will the author be held liable for any damages | |||
arising from the use of this header file. | |||
Permission is granted to anyone to use this header file for any purpose, | |||
including commercial applications, and to alter it and redistribute | |||
it freely, subject to the following restrictions: | |||
#The origin of this header file must not be misrepresented; you must not claim that you wrote the original header file. If you use this header file in a product, an acknowledgment in the product documentation would be appreciated but is not required. | |||
#Altered versions must be plainly marked as such, and must not be misrepresented as being the original header file. | |||
#This notice may not be removed or altered from any distribution. | |||
[[Category:Headers]] | |||
[[Category:User Interface Functions]] |
Latest revision as of 16:25, 25 July 2007
Author: Red Wine (talk, contrib) |
Description
Shows the user a readme page based on the MUI license page.
Use ${ReadmeLanguage} and ${Un.ReadmeLanguage} to define the strings for individual languages and use
MUI_PAGE_README and/or MUI_UNPAGE_README to show the page, just as you'd show any other MUI page.
A complete usage example is available below.
Note:
Header is tested and fully compatible with NSIS Modern User Interface (MUI).
Please don't ask me how to implement the header with 3rd party UIs.
The Header
# MUI_EXTRAPAGES.nsh # By Red Wine Jan 2007 !verbose push !verbose 3 !ifndef _MUI_EXTRAPAGES_NSH !define _MUI_EXTRAPAGES_NSH !ifmacrondef MUI_EXTRAPAGE_README & MUI_PAGE_README & MUI_UNPAGE_README & ReadmeLangStrings !macro MUI_EXTRAPAGE_README UN ReadmeFile !verbose push !verbose 3 !define MUI_PAGE_HEADER_TEXT "$(${UN}ReadmeHeader)" !define MUI_PAGE_HEADER_SUBTEXT "$(${UN}ReadmeSubHeader)" !define MUI_LICENSEPAGE_TEXT_TOP "$(${UN}ReadmeTextTop)" !define MUI_LICENSEPAGE_TEXT_BOTTOM "$(${UN}ReadmeTextBottom)" !define MUI_LICENSEPAGE_BUTTON "$(^NextBtn)" !insertmacro MUI_${UN}PAGE_LICENSE "${ReadmeFile}" !verbose pop !macroend !define ReadmeRun "!insertmacro MUI_EXTRAPAGE_README" !macro MUI_PAGE_README ReadmeFile !verbose push !verbose 3 ${ReadmeRun} "" "${ReadmeFile}" !verbose pop !macroend !macro MUI_UNPAGE_README ReadmeFile !verbose push !verbose 3 ${ReadmeRun} "UN" "${ReadmeFile}" !verbose pop !macroend !macro ReadmeLangStrings UN MUI_LANG ReadmeHeader ReadmeSubHeader ReadmeTextTop ReadmeTextBottom !verbose push !verbose 3 LangString ${UN}ReadmeHeader ${MUI_LANG} "${ReadmeHeader}" LangString ${UN}ReadmeSubHeader ${MUI_LANG} "${ReadmeSubHeader}" LangString ${UN}ReadmeTextTop ${MUI_LANG} "${ReadmeTextTop}" LangString ${UN}ReadmeTextBottom ${MUI_LANG} "${ReadmeTextBottom}" !verbose pop !macroend !define ReadmeLanguage `!insertmacro ReadmeLangStrings ""` !define Un.ReadmeLanguage `!insertmacro ReadmeLangStrings "UN"` !endif !endif !verbose pop
Usage Example
;NSIS Modern User Interface ;Welcome/Finish Page Example Script ;Written by Joost Verburg ;-------------------------------- ;Include Modern UI !include "MUI.nsh" ;-------------------------------- ;Énclude MUI_EXTRAPAGES header !include "MUI_EXTRAPAGES.nsh" ;-------------------------------- ;General ;Name and file Name "Modern UI Test" OutFile "WelcomeFinish.exe" ;Default installation folder InstallDir "$PROGRAMFILES\Modern UI Test" ;Get installation folder from registry if available InstallDirRegKey HKCU "Software\Modern UI Test" "" ;-------------------------------- ;Interface Settings !define MUI_ABORTWARNING ;-------------------------------- ;Installer Pages !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt" ;Add the install read me page !insertmacro MUI_PAGE_README "${NSISDIR}\Docs\Modern UI\Changelog.txt" !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_FINISH ;-------------------------------- ;Uninstaller Pages !insertmacro MUI_UNPAGE_WELCOME ;Add the uninstall read me page !insertmacro MUI_UNPAGE_README '${NSISDIR}\License.txt' !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES !insertmacro MUI_UNPAGE_FINISH ;-------------------------------- ;Languages ;Add 1st language !insertmacro MUI_LANGUAGE "English" ;Set up install lang strings for 1st lang ${ReadmeLanguage} "${LANG_ENGLISH}" \ "Read Me" \ "Please review the following important information." \ "About $(^name):" \ "$\n Click on scrollbar arrows or press Page Down to review the entire text." ;Set up uninstall lang strings for 1st lang ${Un.ReadmeLanguage} "${LANG_ENGLISH}" \ "Read Me" \ "Please review the following important Uninstall information." \ "About $(^name) Uninstall:" \ "$\n Click on scrollbar arrows or press Page Down to review the entire text." ;Add 2nd language !insertmacro MUI_LANGUAGE "Greek" ;set up install lang strings for second lang ${ReadmeLanguage} "${LANG_GREEK}" \ "Read Me" \ "Please review the following important information." \ "About $(^name):" \ "$\n Click on scrollbar arrows or press Page Down to review the entire text." ;set up uninstall lang strings for second lang ${Un.ReadmeLanguage} "${LANG_GREEK}" \ "Read Me" \ "Please review the following important Uninstall information." \ "About $(^name) Uninstall:" \ "$\n Click on scrollbar arrows or press Page Down to review the entire text." ;-------------------------------- ;Installer Sections Section "Dummy Section" SecDummy SetOutPath "$INSTDIR" ;ADD YOUR OWN FILES HERE... ;Store installation folder WriteRegStr HKCU "Software\Modern UI Test" "" $INSTDIR ;Create uninstaller WriteUninstaller "$INSTDIR\Uninstall.exe" SectionEnd ;-------------------------------- ;Descriptions ;Language strings LangString DESC_SecDummy ${LANG_ENGLISH} "A test section." LangString DESC_SecDummy ${LANG_GREEK} "A test section." ;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\Uninstall.exe" RMDir "$INSTDIR" DeleteRegKey /ifempty HKCU "Software\Modern UI Test" SectionEnd ;------------------------------- ;Functions Function .onInit !insertmacro MUI_LANGDLL_DISPLAY FunctionEnd Function un.onInit !insertmacro MUI_UNGETLANGUAGE FunctionEnd
License
This header file is provided 'as-is', without any express or implied warranty. In no event will the author be held liable for any damages arising from the use of this header file.
Permission is granted to anyone to use this header file for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
- The origin of this header file must not be misrepresented; you must not claim that you wrote the original header file. If you use this header file in a product, an acknowledgment in the product documentation would be appreciated but is not required.
- Altered versions must be plainly marked as such, and must not be misrepresented as being the original header file.
- This notice may not be removed or altered from any distribution.