new langdll macro / registry system, startmenu registry system, write instdir to registry

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2264 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
joostverburg 2003-03-09 22:38:13 +00:00
parent a1ff4f5102
commit 39d58a46d2
9 changed files with 157 additions and 83 deletions

View file

@ -4,9 +4,11 @@ NSIS Modern User Interface - VERSION HISTORY
* Support for a bitmap in the wizard header * Support for a bitmap in the wizard header
* New defines to change the description area * New defines to change the description area
* MUI_SYSTEM inserted automatically * MUI_SYSTEM inserted automatically
* Single macro for language selection dialog
* Removed page description in window title * Removed page description in window title
* Easier to customize resource files * Easier to customize resource files
* New system for custom functions * New system for custom functions
* Start Menu folder registry key automatically written
* New InstallOptions macro's that do not remove the return value from * New InstallOptions macro's that do not remove the return value from
the stack the stack
* Support for custom pages before the finish page * Support for custom pages before the finish page

View file

@ -184,9 +184,10 @@ follow these steps:</p>
shortcuts.</p> shortcuts.</p>
<p class="text"><span class="bold">MUI_STARTMENUPAGE_REGISTRY_ROOT, <p class="text"><span class="bold">MUI_STARTMENUPAGE_REGISTRY_ROOT,
MUI_STARTMENUPAGE_REGISTRY_KEY, MUI_STARTMENUPAGE_REGISTRY_VALUENAME</span><br /> MUI_STARTMENUPAGE_REGISTRY_KEY, MUI_STARTMENUPAGE_REGISTRY_VALUENAME</span><br />
If your installer saves the Start Menu folder of a previous installation The registry key to store the Start Menu folder. The page will use it to
in a registry, define these values and the Modern UI will use the saved remember the users preference. You should also use it in the uninstaller to
value as default folder.</p> remove the Start Menu folders. Don't forget to remove this key in the
uninstaller.</p>
</div> </div>
<p class="text"><span class="bold">MUI_FINISHPAGE</span><br /> <p class="text"><span class="bold">MUI_FINISHPAGE</span><br />
Show the finish page. The finish page tells that the installation is succesful. Show the finish page. The finish page tells that the installation is succesful.
@ -306,12 +307,23 @@ follow these steps:</p>
</pre> </pre>
<p class="text">Have a look at the language files for a complete list of all the <p class="text">Have a look at the language files for a complete list of all the
string names.</p> string names.</p>
<p class="text">If you are using the LangDLL for a language selection dialog <p class="text">If you want the installer to display a language selection dialog
(have a look at the <a href="../../Examples/Modern UI/MultiLanguage.nsi"> (have a look at the <a href="../../Examples/Modern UI/MultiLanguage.nsi">
MultiLanguage.nsi</a> example) use MUI_LANGDLL_PUSH to add the name of the MultiLanguage.nsi</a> example), insert the MUI_LANGDLL_DISPLAY macro in .onInit:</p>
language (in the language itself) to the stack:</p>
<pre class="margin"> <pre class="margin">
!insertmacro MUI_LANGDLL_PUSH "English" ;Parameter = Language file name in English</pre> Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd
</pre>
<p class="text">To customize the texts on the language selection dialog, define
MUI_TEXT_LANGDLL_WINDOWTITLE and MUI_TEXT_LANGDLL_INFO before inserting the macro.</p>
<p class="text">If you want the installer to remember the users language
preference, define MUI_STARTMENUPAGE_REGISTRY_ROOT, MUI_STARTMENUPAGE_REGISTRY_KEY
and MUI_STARTMENUPAGE_REGISTRY_VALUENAME to set a registry key to store the
language. You can also use it in the uninstaller to display the right language.
Don't forget to remove this key in the uninstaller.</p>
<p class="subheader">9. Insert the MUI_SECTIONS_FINISHHEADER macro</p> <p class="subheader">9. Insert the MUI_SECTIONS_FINISHHEADER macro</p>
<p class="text">If you are not using a Finish page without defining <p class="text">If you are not using a Finish page without defining
MUI_FINISHPAGE_NOAUTOCLOSEWINDOW and have not set AutoCloseWindow MUI_FINISHPAGE_NOAUTOCLOSEWINDOW and have not set AutoCloseWindow
@ -564,9 +576,11 @@ FunctionEnd
<li>Support for a bitmap in the wizard header</li> <li>Support for a bitmap in the wizard header</li>
<li>New defines to change the description area</li> <li>New defines to change the description area</li>
<li>MUI_SYSTEM inserted automatically</li> <li>MUI_SYSTEM inserted automatically</li>
<li>Single macro for language selection dialog</li>
<li>Removed page description in window title</li> <li>Removed page description in window title</li>
<li>Easier to customize resource files</li> <li>Easier to customize resource files</li>
<li>New system for custom functions</li> <li>New system for custom functions</li>
<li>Start Menu folder registry key automatically written</li>
<li>New InstallOptions macro's that do not remove the return value from <li>New InstallOptions macro's that do not remove the return value from
the stack</li> the stack</li>
<li>Support for custom pages before the finish page</li> <li>Support for custom pages before the finish page</li>

View file

@ -2,8 +2,7 @@
;Macro System ;Macro System
;Written by Joost Verburg ;Written by Joost Verburg
;Have a look the scripts in the 'Examples\Modern UI' ;Have a look the scripts in the 'Examples\Modern UI' directory for examples of usage.
;directory for examples of usage.
;-------------------------------- ;--------------------------------
@ -15,7 +14,7 @@
!define MUI_MACROS_USED !define MUI_MACROS_USED
!include "${NSISDIR}\Include\WinMessages.nsh" !include "WinMessages.nsh"
!define MUI_TEMP1 $R0 !define MUI_TEMP1 $R0
!define MUI_TEMP2 $R1 !define MUI_TEMP2 $R1
@ -254,7 +253,7 @@
StrCmp $0 ${VAR} "" +3 StrCmp $0 ${VAR} "" +3
SendMessage ${MUI_TEMP1} ${WM_SETTEXT} 0 "STR:${TEXT}" SendMessage ${MUI_TEMP1} ${WM_SETTEXT} 0 "STR:${TEXT}"
Goto done Goto description_done
!ifndef MUI_NOVERBOSE !ifndef MUI_NOVERBOSE
!ifndef MUI_MANUALVERBOSE !ifndef MUI_MANUALVERBOSE
@ -272,7 +271,7 @@
!endif !endif
!endif !endif
done: description_done:
Pop ${MUI_TEMP1} Pop ${MUI_TEMP1}
!ifndef MUI_NOVERBOSE !ifndef MUI_NOVERBOSE
@ -439,16 +438,9 @@
!macro MUI_LANGDLL_PUSH LANGUAGE !macro MUI_LANGDLL_PUSH LANGUAGE
!ifndef MUI_MANUALVERBOSE ;1.62 compatibility
!verbose 3
!endif
Push "${LANG_${LANGUAGE}}" !error "To use the language selection dialog, you only have to add '!insertmacro MUI_LANGDLL_DISPLAY' to .onInit now. You should remove all the other code and Push commands."
Push "${MUI_${LANGUAGE}_LANGNAME}"
!ifndef MUI_MANUALVERBOSE
!verbose 4
!endif
!macroend !macroend
@ -470,6 +462,10 @@
!macro MUI_STARTMENU_WRITE_END !macro MUI_STARTMENU_WRITE_END
!verbose 3 !verbose 3
!ifdef MUI_STARTMENUPAGE_REGISTRY_ROOT & MUI_STARTMENUPAGE_REGISTRY_KEY & MUI_STARTMENUPAGE_REGISTRY_VALUENAME
WriteRegStr "${MUI_STARTMENUPAGE_REGISTRY_ROOT}" "${MUI_STARTMENUPAGE_REGISTRY_KEY}" "${MUI_STARTMENUPAGE_REGISTRY_VALUENAME}" "${MUI_STARTMENUPAGE_VARIABLE}"
!endif
no_startmenu_shortcuts: no_startmenu_shortcuts:
@ -477,6 +473,49 @@
!macroend !macroend
!macro MUI_LANGDLL_DISPLAY
!ifndef MUI_MANUALVERBOSE
!verbose 3
!endif
!ifndef MUI_TEXT_LANGDLL_WINDOWTITLE
!define MUI_TEXT_LANGDLL_WINDOWTITLE "Installer Language"
!endif
!ifndef MUI_TEXT_LANGDLL_INFO
!define MUI_TEXT_LANGDLL_INFO "Please select a language."
!endif
!ifdef MUI_LANGDLL_REGISTRY_ROOT & MUI_LANGDLL_REGISTRY_KEY & MUI_LANGDLL_REGISTRY_VALUENAME
Push ${MUI_TEMP1}
ReadRegStr ${MUI_TEMP1} "${MUI_LANGDLL_REGISTRY_ROOT}" "${MUI_LANGDLL_REGISTRY_KEY}" "${MUI_LANGDLL_REGISTRY_VALUENAME}"
StrCmp ${MUI_TEMP1} "" showlangdialog
StrCpy $LANGUAGE ${MUI_TEMP1}
Goto langdll_done
showlangdialog:
Pop ${MUI_TEMP1}
!endif
LangDLL::LangDialog "${MUI_TEXT_LANGDLL_WINDOWTITLE}" "${MUI_TEXT_LANGDLL_INFO}" AF ${MUI_LANGDLL_PUSHLIST} "" 8 "${MUI_FONT}"
Pop $LANGUAGE
StrCmp $LANGUAGE "cancel" 0 +2
Abort
!ifdef MUI_LANGDLL_REGISTRY_ROOT & MUI_LANGDLL_REGISTRY_KEY & MUI_LANGDLL_REGISTRY_VALUENAME
WriteRegStr "${MUI_LANGDLL_REGISTRY_ROOT}" "${MUI_LANGDLL_REGISTRY_KEY}" "${MUI_LANGDLL_REGISTRY_VALUENAME}" $LANGUAGE
langdll_done:
!endif
!ifndef MUI_MANUALVERBOSE
!verbose 4
!endif
!macroend
;-------------------------------- ;--------------------------------
;PAGE COMMANDS ;PAGE COMMANDS
@ -1201,7 +1240,7 @@
!insertmacro MUI_HEADER_TEXT $(MUI_TEXT_STARTMENU_TITLE) $(MUI_TEXT_STARTMENU_SUBTITLE) !insertmacro MUI_HEADER_TEXT $(MUI_TEXT_STARTMENU_TITLE) $(MUI_TEXT_STARTMENU_SUBTITLE)
!ifdef MUI_STARTMENUPAGE_REGISTRY_ROOT & MUI_STARTMENUPAGE_REGISTRY_KEY & MUI_STARTMENUPAGE_REGISTRY_VALUENAME !ifdef MUI_STARTMENUPAGE_REGISTRY_ROOT & MUI_STARTMENUPAGE_REGISTRY_KEY & MUI_STARTMENUPAGE_REGISTRY_VALUENAME
StrCmp "${MUI_STARTMENUPAGE_VARIABLE}" "" "" +4 StrCmp "${MUI_STARTMENUPAGE_VARIABLE}" "" "" +4
ReadRegStr ${MUI_TEMP1} "${MUI_STARTMENUPAGE_REGISTRY_ROOT}" "${MUI_STARTMENUPAGE_REGISTRY_KEY}" "${MUI_STARTMENUPAGE_REGISTRY_VALUENAME}" ReadRegStr ${MUI_TEMP1} "${MUI_STARTMENUPAGE_REGISTRY_ROOT}" "${MUI_STARTMENUPAGE_REGISTRY_KEY}" "${MUI_STARTMENUPAGE_REGISTRY_VALUENAME}"
@ -1796,8 +1835,10 @@
!macro MUI_SYSTEM !macro MUI_SYSTEM
!ifndef MUI_MANUALVERBOSE !ifndef MUI_NOVERBOSE
!verbose 3 !ifndef MUI_MANUALVERBOSE
!verbose 3
!endif
!endif !endif
!ifndef MUI_SYSTEM_INSERTED !ifndef MUI_SYSTEM_INSERTED
@ -1806,25 +1847,24 @@
;1.62 compatibility ;1.62 compatibility
!ifdef MUI_STARTMENU_VARIABLE || MUI_STARTMENU_DEFAULTFOLDER || MUI_STARTMENU_REGISTRY_ROOT !ifdef MUI_STARTMENU_VARIABLE || MUI_STARTMENU_DEFAULTFOLDER || MUI_STARTMENU_REGISTRY_ROOT
!error "The Start Menu Folder page defines have been renamed from MUI_STARTMENU_??? to MUI_STARTMENUPAGE_???. Please change this in your script." !error "The Start Menu Folder page defines have been renamed from MUI_STARTMENU_??? to MUI_STARTMENUPAGE_???. Please rename these defines in your script."
!endif !endif
!define MUI_NOVERBOSE
!insertmacro MUI_INTERFACE !insertmacro MUI_INTERFACE
!insertmacro MUI_BASIC !insertmacro MUI_BASIC
!insertmacro MUI_UNBASIC !insertmacro MUI_UNBASIC
!undef MUI_NOVERBOSE
!else !else
;1.62 compatibility
!warning "The MUI_SYSTEM macro is now being inserted automatically. You can remove '!insertmacro MUI_SYSTEM' from your script." !warning "The MUI_SYSTEM macro is now being inserted automatically. You can remove '!insertmacro MUI_SYSTEM' from your script."
!endif !endif
!ifndef MUI_MANUALVERBOSE !ifndef MUI_NOVERBOSE
!verbose 4 !ifndef MUI_MANUALVERBOSE
!verbose 4
!endif
!endif !endif
!macroend !macroend
@ -1882,7 +1922,10 @@
!ifndef MUI_SYSTEM_INSERT !ifndef MUI_SYSTEM_INSERT
!define MUI_SYSTEM_INSERT !define MUI_SYSTEM_INSERT
!insertmacro MUI_SYSTEM
!define MUI_NOVERBOSE
!insertmacro MUI_SYSTEM
!undef MUI_NOVERBOSE
!endif !endif
@ -1989,7 +2032,18 @@
!macro MUI_LANGUAGEFILE_END !macro MUI_LANGUAGEFILE_END
!insertmacro MUI_LANGUAGEFILE_DEFINE "MUI_${LANGUAGE}_LANGNAME" "MUI_LANGNAME" !insertmacro MUI_LANGUAGEFILE_DEFINE "MUI_${LANGUAGE}_LANGNAME" "MUI_LANGNAME"
!ifndef MUI_LANGDLL_PUSHLIST
!define MUI_LANGDLL_PUSHLIST "'${MUI_${LANGUAGE}_LANGNAME}' ${LANG_${LANGUAGE}} "
!else
!ifdef MUI_LANGDLL_PUSHLIST_TEMP
!undef MUI_LANGDLL_PUSHLIST_TEMP
!endif
!define MUI_LANGDLL_PUSHLIST_TEMP "${MUI_LANGDLL_PUSHLIST}"
!undef MUI_LANGDLL_PUSHLIST
!define MUI_LANGDLL_PUSHLIST "'${MUI_${LANGUAGE}_LANGNAME}' ${LANG_${LANGUAGE}} ${MUI_LANGDLL_PUSHLIST_TEMP}"
!endif
!insertmacro MUI_LANGUAGEFILE_NSISCOMMAND "Name" "MUI_NAME" !insertmacro MUI_LANGUAGEFILE_NSISCOMMAND "Name" "MUI_NAME"
SubCaption 0 " " SubCaption 0 " "

View file

@ -15,6 +15,9 @@
;Folder selection page ;Folder selection page
InstallDir "$PROGRAMFILES\${MUI_PRODUCT}" InstallDir "$PROGRAMFILES\${MUI_PRODUCT}"
;Remember install folder
InstallDirRegKey HKCU "Softare\${MUI_PRODUCT}" ""
;-------------------------------- ;--------------------------------
;Modern UI Configuration ;Modern UI Configuration
@ -54,6 +57,9 @@ Section "modern.exe" SecCopyUI
SetOutPath "$INSTDIR" SetOutPath "$INSTDIR"
File "${NSISDIR}\Contrib\UIs\modern.exe" File "${NSISDIR}\Contrib\UIs\modern.exe"
;Store install folder
WriteRegStr HKCU "Softare\${MUI_PRODUCT}" "" $INSTDIR
;Create uninstaller ;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe" WriteUninstaller "$INSTDIR\Uninstall.exe"
@ -82,6 +88,8 @@ Section "Uninstall"
RMDir "$INSTDIR" RMDir "$INSTDIR"
DeleteRegKey /ifempty HKCU "Software\${MUI_PRODUCT}"
;Display the Finish header ;Display the Finish header
!insertmacro MUI_UNFINISHHEADER !insertmacro MUI_UNFINISHHEADER

View file

@ -15,6 +15,9 @@
;Folder selection page ;Folder selection page
InstallDir "$PROGRAMFILES\${MUI_PRODUCT}" InstallDir "$PROGRAMFILES\${MUI_PRODUCT}"
;Remember install folder
InstallDirRegKey HKCU "Softare\${MUI_PRODUCT}" ""
;-------------------------------- ;--------------------------------
;Modern UI Configuration ;Modern UI Configuration
@ -56,6 +59,9 @@ Section "modern.exe" SecCopyUI
SetOutPath "$INSTDIR" SetOutPath "$INSTDIR"
File "${NSISDIR}\Contrib\UIs\modern.exe" File "${NSISDIR}\Contrib\UIs\modern.exe"
;Store install folder
WriteRegStr HKCU "Softare\${MUI_PRODUCT}" "" $INSTDIR
;Create uninstaller ;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe" WriteUninstaller "$INSTDIR\Uninstall.exe"
@ -84,6 +90,8 @@ Section "Uninstall"
RMDir "$INSTDIR" RMDir "$INSTDIR"
DeleteRegKey /ifempty HKCU "Software\${MUI_PRODUCT}"
;Display the Finish header ;Display the Finish header
!insertmacro MUI_UNFINISHHEADER !insertmacro MUI_UNFINISHHEADER

View file

@ -17,6 +17,9 @@
;Folder selection page ;Folder selection page
InstallDir "$PROGRAMFILES\${MUI_PRODUCT}" InstallDir "$PROGRAMFILES\${MUI_PRODUCT}"
;Remember install folder
InstallDirRegKey HKCU "Softare\${MUI_PRODUCT}" ""
;-------------------------------- ;--------------------------------
;Modern UI Configuration ;Modern UI Configuration
@ -89,6 +92,9 @@ Section "modern.exe" SecCopyUI
SetOutPath "$INSTDIR" SetOutPath "$INSTDIR"
File "${NSISDIR}\Contrib\UIs\modern.exe" File "${NSISDIR}\Contrib\UIs\modern.exe"
;Store install folder
WriteRegStr HKCU "Softare\${MUI_PRODUCT}" "" $INSTDIR
;Read a value from an InstallOptions INI File ;Read a value from an InstallOptions INI File
!insertmacro MUI_INSTALLOPTIONS_READ ${TEMP} "ioC.ini" "Field 2" "State" !insertmacro MUI_INSTALLOPTIONS_READ ${TEMP} "ioC.ini" "Field 2" "State"
StrCmp ${TEMP} "1" "" +2 StrCmp ${TEMP} "1" "" +2
@ -150,6 +156,8 @@ Section "Uninstall"
RMDir "$INSTDIR" RMDir "$INSTDIR"
DeleteRegKey /ifempty HKCU "Software\${MUI_PRODUCT}"
!insertmacro MUI_UNFINISHHEADER !insertmacro MUI_UNFINISHHEADER
SectionEnd SectionEnd

View file

@ -15,6 +15,14 @@
;Folder selection page ;Folder selection page
InstallDir "$PROGRAMFILES\${MUI_PRODUCT}" InstallDir "$PROGRAMFILES\${MUI_PRODUCT}"
;Remember install folder
InstallDirRegKey HKCU "Softare\${MUI_PRODUCT}" ""
;Remember the installer language
!define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
!define MUI_LANGDLL_REGISTRY_KEY "Software\${MUI_PRODUCT}"
!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
;-------------------------------- ;--------------------------------
;Modern UI Configuration ;Modern UI Configuration
@ -133,8 +141,8 @@ Section "modern.exe" SecCopyUI
SetOutPath "$INSTDIR" SetOutPath "$INSTDIR"
File "${NSISDIR}\Contrib\UIs\modern.exe" File "${NSISDIR}\Contrib\UIs\modern.exe"
;Write language to the registry (for the uninstaller) ;Store install folder
WriteRegStr HKCU "Software\${MUI_PRODUCT}" "Installer Language" $LANGUAGE WriteRegStr HKCU "Softare\${MUI_PRODUCT}" "" $INSTDIR
WriteUninstaller "$INSTDIR\Uninstall.exe" WriteUninstaller "$INSTDIR\Uninstall.exe"
@ -149,46 +157,7 @@ SectionEnd
Function .onInit Function .onInit
;Language selection !insertmacro MUI_LANGDLL_DISPLAY
;Font
Push Tahoma
Push 8
;Languages
!insertmacro MUI_LANGDLL_PUSH "English"
!insertmacro MUI_LANGDLL_PUSH "French"
!insertmacro MUI_LANGDLL_PUSH "German"
!insertmacro MUI_LANGDLL_PUSH "Spanish"
!insertmacro MUI_LANGDLL_PUSH "SimpChinese"
!insertmacro MUI_LANGDLL_PUSH "TradChinese"
!insertmacro MUI_LANGDLL_PUSH "Japanese"
!insertmacro MUI_LANGDLL_PUSH "Korean"
!insertmacro MUI_LANGDLL_PUSH "Italian"
!insertmacro MUI_LANGDLL_PUSH "Dutch"
!insertmacro MUI_LANGDLL_PUSH "Danish"
!insertmacro MUI_LANGDLL_PUSH "Greek"
!insertmacro MUI_LANGDLL_PUSH "Russian"
!insertmacro MUI_LANGDLL_PUSH "PortugueseBR"
!insertmacro MUI_LANGDLL_PUSH "Polish"
!insertmacro MUI_LANGDLL_PUSH "Ukrainian"
!insertmacro MUI_LANGDLL_PUSH "Czech"
!insertmacro MUI_LANGDLL_PUSH "Slovak"
!insertmacro MUI_LANGDLL_PUSH "Croatian"
!insertmacro MUI_LANGDLL_PUSH "Bulgarian"
!insertmacro MUI_LANGDLL_PUSH "Hungarian"
!insertmacro MUI_LANGDLL_PUSH "Thai"
!insertmacro MUI_LANGDLL_PUSH "Romanian"
!insertmacro MUI_LANGDLL_PUSH "Macedonian"
!insertmacro MUI_LANGDLL_PUSH "Turkish"
Push 25F ;25 = number of languages, F = change font
LangDLL::LangDialog "Installer Language" "Please select a language."
Pop $LANGUAGE
StrCmp $LANGUAGE "cancel" 0 +2
Abort
FunctionEnd FunctionEnd
@ -210,8 +179,8 @@ Section "Uninstall"
Delete "$INSTDIR\Uninstall.exe" Delete "$INSTDIR\Uninstall.exe"
RMDir "$INSTDIR" RMDir "$INSTDIR"
DeleteRegValue HKCU "Software\${MUI_PRODUCT}" "Installer Language" DeleteRegKey /ifempty HKCU "Software\${MUI_PRODUCT}"
;Display the Finish header ;Display the Finish header
!insertmacro MUI_UNFINISHHEADER !insertmacro MUI_UNFINISHHEADER

View file

@ -16,6 +16,9 @@
;Folder selection page ;Folder selection page
InstallDir "$PROGRAMFILES\${MUI_PRODUCT}" InstallDir "$PROGRAMFILES\${MUI_PRODUCT}"
;Remember install folder
InstallDirRegKey HKCU "Softare\${MUI_PRODUCT}" ""
;$9 is being used to store the Start Menu Folder. ;$9 is being used to store the Start Menu Folder.
;Do not use this variable in your script (or Push/Pop it)! ;Do not use this variable in your script (or Push/Pop it)!
@ -69,6 +72,9 @@ Section "modern.exe" SecCopyUI
SetOutPath "$INSTDIR" SetOutPath "$INSTDIR"
File "${NSISDIR}\Contrib\UIs\modern.exe" File "${NSISDIR}\Contrib\UIs\modern.exe"
;Store install folder
WriteRegStr HKCU "Softare\${MUI_PRODUCT}" "" $INSTDIR
!insertmacro MUI_STARTMENU_WRITE_BEGIN !insertmacro MUI_STARTMENU_WRITE_BEGIN
;Create shortcuts ;Create shortcuts
@ -76,9 +82,6 @@ Section "modern.exe" SecCopyUI
CreateShortCut "$SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}\Modern UI.lnk" "$INSTDIR\modern.exe" CreateShortCut "$SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}\Modern UI.lnk" "$INSTDIR\modern.exe"
CreateShortCut "$SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}\Uninstall.lnk" "$INSTDIR\Uninstall.exe" CreateShortCut "$SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
;Write shortcut location to the registry (for Uninstaller)
WriteRegStr HKCU "Software\${MUI_PRODUCT}" "Start Menu Folder" "${MUI_STARTMENUPAGE_VARIABLE}"
!insertmacro MUI_STARTMENU_WRITE_END !insertmacro MUI_STARTMENU_WRITE_END
;Create uninstaller ;Create uninstaller
@ -108,7 +111,7 @@ Section "Uninstall"
Delete "$INSTDIR\Uninstall.exe" Delete "$INSTDIR\Uninstall.exe"
;Remove shortcut ;Remove shortcut
ReadRegStr ${TEMP} HKCU "Software\${MUI_PRODUCT}" "Start Menu Folder" ReadRegStr ${TEMP} "${MUI_STARTMENUPAGE_REGISTRY_ROOT}" "${MUI_STARTMENUPAGE_REGISTRY_KEY}" "${MUI_STARTMENUPAGE_REGISTRY_VALUENAME}"
StrCmp ${TEMP} "" noshortcuts StrCmp ${TEMP} "" noshortcuts
@ -119,8 +122,8 @@ Section "Uninstall"
noshortcuts: noshortcuts:
RMDir "$INSTDIR" RMDir "$INSTDIR"
DeleteRegValue HKCU "Software\${MUI_PRODUCT}" "Start Menu Folder" DeleteRegKey /ifempty HKCU "Software\${MUI_PRODUCT}"
;Display the Finish header ;Display the Finish header
!insertmacro MUI_UNFINISHHEADER !insertmacro MUI_UNFINISHHEADER

View file

@ -15,6 +15,9 @@
;Folder selection page ;Folder selection page
InstallDir "$PROGRAMFILES\${MUI_PRODUCT}" InstallDir "$PROGRAMFILES\${MUI_PRODUCT}"
;Remember install folder
InstallDirRegKey HKCU "Softare\${MUI_PRODUCT}" ""
;-------------------------------- ;--------------------------------
;Modern UI Configuration ;Modern UI Configuration
@ -63,6 +66,9 @@ Section "modern.exe" SecCopyUI
SetOutPath "$INSTDIR" SetOutPath "$INSTDIR"
File "${NSISDIR}\Contrib\UIs\modern.exe" File "${NSISDIR}\Contrib\UIs\modern.exe"
;Store install folder
WriteRegStr HKCU "Softare\${MUI_PRODUCT}" "" $INSTDIR
;Create uninstaller ;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe" WriteUninstaller "$INSTDIR\Uninstall.exe"
@ -88,6 +94,8 @@ Section "Uninstall"
RMDir "$INSTDIR" RMDir "$INSTDIR"
DeleteRegKey /ifempty HKCU "Software\${MUI_PRODUCT}"
!insertmacro MUI_UNFINISHHEADER !insertmacro MUI_UNFINISHHEADER
SectionEnd SectionEnd