I have my .nsi with this configuration:
#########################################################################
## Language Selection Dialog Settings
## Remember the installer language
!define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
!define MUI_LANGDLL_REGISTRY_KEY "Software\${APP_COMPANY}\${APP_PRODUCT}"
!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
## Languages (first language is the default language)
!insertmacro MUI_LANGUAGE "Portuguese"
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "French"
!insertmacro MUI_LANGUAGE "Spanish"
!insertmacro MUI_LANGUAGE "Dutch"
## Language selection functions (for install and uninstall)
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd
## Uninstaller Functions
Function un.onInit
!insertmacro MUI_UNGETLANGUAGE
FunctionEnd
But when I try to uninstall the uninstaller shows me the language dialog everytime.
I follow the MUI2 README and I don't know what I'm doing wrong.
The registry value specified by MUI_LANGDLL_REGISTRY_* is saved automatically by MUI on the MUI_PAGE_INSTFILES page. If you are not using this page then you can call the MUI_LANGDLL_SAVELANGUAGE macro yourself or manually write the value of $LANGUAGE.
I would recommend just using the MUI_PAGE_INSTFILES page so everything is taken care of for you:
!define APP_COMPANY "Foo"
!define APP_PRODUCT "Bar"
!include MUI2.nsh
InstallDir "$Temp\Test"
RequestExecutionLevel user
#########################################################################
## Language Selection Dialog Settings
## Remember the installer language
!define MUI_LANGDLL_REGISTRY_ROOT HKCU
!define MUI_LANGDLL_REGISTRY_KEY "Software\${APP_COMPANY}\${APP_PRODUCT}"
!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
## Languages (first language is the default language)
!insertmacro MUI_LANGUAGE "Portuguese"
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "French"
!insertmacro MUI_LANGUAGE "Spanish"
!insertmacro MUI_LANGUAGE "Dutch"
## Language selection functions (for install and uninstall)
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd
## Uninstaller Functions
Function un.onInit
!insertmacro MUI_UNGETLANGUAGE
FunctionEnd
Section
SetOutPath $InstDir
WriteUninstaller "$InstDir\Uninst.exe"
SectionEnd
Section Uninstall
DeleteRegKey HKCU "Software\${APP_COMPANY}\${APP_PRODUCT}"
DeleteRegKey /IfEmpty HKCU "Software\${APP_COMPANY}"
Delete "$InstDir\Uninst.exe"
RMDir $InstDir
SectionEnd
Related
My installer copies Uninstall.exe and /temp/ directory to the installation folder (for me it is C:\MyExample), but MyExample.dll/ico/exe, and success/error.wav are copied directly to C:\ and I can't get this working.
!include "MUI2.nsh"
;General
Function .onInit
ReadEnvStr $R0 SYSTEMDRIVE
StrCpy $INSTDIR `$R0\MyExample\`
FunctionEnd
Name "MyExample"
OutFile "Setup.exe"
RequestExecutionLevel admin
;--------------------------------
!define MUI_ABORTWARNING
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink"
!define MUI_FINISHPAGE_SHOWREADME ""
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
!define MUI_FINISHPAGE_SHOWREADME_TEXT "Create Desktop Shortcut"
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION finishpageaction
;--------------------------------
;Pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Installer Sections
Section "Dummy Section" SecDummy
File "MyExample.exe"
File "MyExample.ico"
File "error.wav"
File "success.wav"
File "MyExample.dll"
CreateDirectory $INSTDIR\temp
SetOutPath "$INSTDIR"
WriteRegStr HKCU "Software\MyExample" "" $INSTDIR
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Product\MyExample" \
"MyExample" "$\"$INSTDIR\uninstall.exe$\""
SectionEnd
Section "Uninstall"
# Always delete uninstaller first
delete $INSTDIR\uninstall.exe
delete $INSTDIR\MyExample.exe
delete $INSTDIR\MyExample.ico
delete $INSTDIR\error.wav
delete $INSTDIR\success.wav
delete $INSTDIR\MyExample.dll
SectionEnd
;--------------------------------
;Descriptions
LangString DESC_SecDummy ${LANG_ENGLISH} "Setup"
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
;--------------------------------
;Uninstaller Section
Section "Uninstall"
Delete "$INSTDIR\Uninstall.exe"
RMDir "$INSTDIR"
DeleteRegKey /ifempty HKCU "Software\MyExample"
SectionEnd
Function LaunchLink
ExecShell "" "$INSTDIR\MyExample.exe"
FunctionEnd
Function finishpageaction
CreateShortcut "$desktop\MyExample.lnk" "$instdir\MyExample.exe"
WriteRegStr HKEY_CURRENT_USER "Software\Microsoft\Windows\CurrentVersion\Run" \
"MyExample.exe" "$INSTDIR\MyExample.exe"
FunctionEnd
In your Dummy Section section, you are installing some files without telling the destination directory. I suppose that implicitly meant $INSTDIR, but you need to be explicit as a section might or might not be selected (when you have multiple sections), and they must not rely on side effects of previously executed sections (if ever).
Add the destination folder at the beginning of the section, before the File statements:
SetOutPath $INSTDIR
I have the following script:
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_COMPONENTS
!define MUI_PAGE_CUSTOMFUNCTION_PRE ComponentPost
!insertmacro MUI_PAGE_DIRECTORY
!define MUI_PAGE_CUSTOMFUNCTION_SHOW DirectoryShow
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE DirectoryLeave
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
Unfortunately, after the first directory selection dialog, directory page returns to default, what am i doing wrong?
When using multiple directory pages you also normally want to store the selected paths in different variables:
Var SomeOtherFolder
!define MUI_DIRECTORYPAGE_VARIABLE $SomeOtherFolder
!insertmacro MUI_PAGE_DIRECTORY
...
Section
SetOutPath $SomeOtherFolder
File /r "c:\otherfiles"
Section
All of this information can be found in the Modern UI readme...
I am using the ScrollLicense Plugin with an attempt to force the user to scroll to the end of a License Agreement.
The problem I am hitting is they currently only have to scroll about 1/4th the way down the bar and it enables the "Next" button... has anyone run into this issue before?
Code is pretty straight forward and using everything from the plugin examples
LicenseForceSelection radiobuttons "I accept" "I decline"
!insertmacro MUI_PAGE_WELCOME
!define MUI_PAGE_CUSTOMFUNCTION_SHOW LicenseShow
!insertmacro MUI_PAGE_LICENSE "$(MUILicense)"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
Function LicenseShow
ScrollLicense::Set /NOUNLOAD /RADIOBUTTONS
FunctionEnd
Section -Main
Files here
Section End
Function .onGUIEnd
ScrollLicense::Unload
FunctionEnd
I have an installer that is having problems interacting with the scroll license plugin. The installer works great without the plugin, this is what the plugin has me include:
!
include MUI.nsh
!define MUI_PAGE_CUSTOMFUNCTION_SHOW LicenseShow
!insertmacro MUI_PAGE_LICENSE "EULA.txt"
unction LicenseShow
ScrollLicense::Set /NOUNLOAD
FunctionEnd
Function .onGUIEnd
ScrollLicense::Unload
FunctionEnd
Section A
Section End
The problem I run into is here. If the Welcome page displays BEFORE the License page it will not be able to progress to the next screen because it is looking for a scroll bar and accept button. If I remove the WELCOME page everything works fine. Does anyone have experience with this plugin? or how I can get the plugin to ignore the MUI_PAGE_WELCOME?
!insertmacro MUI_PAGE_WELCOME <--- If I remove this Welcome page everything works great!
!insertmacro MUI_PAGE_LICENSE "eula.rtf"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
Try moving the line:
!define MUI_PAGE_CUSTOMFUNCTION_SHOW LicenseShow
Below the line (more specifically, directly above the MUI_PAGE_LICENSE line):
!insertmacro MUI_PAGE_WELCOME
I used ExampleCheckBox.nsi as supplied from the ScrollLicense plugin and reproduced your behavior when I had:
!define MUI_PAGE_CUSTOMFUNCTION_SHOW LicenseShow
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE ExampleCheckBox.nsi
The problem went away when I moved the !define line to after the MUI_PAGE_WELCOME.
!insertmacro MUI_PAGE_WELCOME
!define MUI_PAGE_CUSTOMFUNCTION_SHOW LicenseShow
!insertmacro MUI_PAGE_LICENSE ExampleCheckBox.nsi
I'm not familiar with this plugin but I suspect there is some kind of side-effect that disables the Next button of the next displayed page...
I think what you are missing is how the example needs to fit into the "flow" of the other MUI pages.
!include MUI.nsh
;;this goes before the License page if you want it first.
!insertmacro MUI_PAGE_WELCOME
;;now add the example stuff
!define MUI_PAGE_CUSTOMFUNCTION_SHOW LicenseShow
!insertmacro MUI_PAGE_LICENSE "EULA.txt" ;;update for what file you want to include!
Function LicenseShow
ScrollLicense::Set /NOUNLOAD
FunctionEnd
Function .onGUIEnd
ScrollLicense::Unload
FunctionEnd
;;now continue with the rest of the pages
;;and we *don't* repeat the MUI_PAGE_LICENSE
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
I'm having trouble with a Nullsoft Installer script.
I'm using the MUI2 interface with the latest (2.46) version of NSIS.
Just after the MUI_PAGE macros:
!define MUI_LANGDLL_ALLLANGUAGES
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "German"
!insertmacro MUI_LANGUAGE "French"
!insertmacro MUI_RESERVEFILE_LANGDLL
First thing in onInit:
!insertmacro MUI_LANGDLL_DISPLAY
The error I get is:
unknown variable/constant
"{MUI_LANGDLL_LANGUAGES_CP}" detected,
ignoring
(macro:MUI_LANGDLL_DISPLAY:35)
Any ideas? I'm pulling my hair out. the only help i can find through google is in Japanese/Chinese
Every time !insertmacro MUI_LANGUAGE xyz is used, it appends the language to a define used by MUI_LANGDLL_DISPLAY...
!define MUI_LANGDLL_ALLLANGUAGES
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "German"
!insertmacro MUI_LANGUAGE "French"
!insertmacro MUI_RESERVEFILE_LANGDLL
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY ;This has to come after the language macros
FunctionEnd