Changing my NSIS installer Application Version - nsis

I am updating an existing application and want to set the new Application Version Number. I used the !define VERSION "Version Number" but the application still retains the previous Version number. I have also been going through NSIS SourceForge in search of the solution but none that could show and then change the Version Number. The Version Number i want to show is 2.1.1259.1 but it keeps returning the old 2.0.236.1258
The code looks as follows:
; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "Application Name"
!define PRODUCT_VERSION "2.1.1259.1"
!define VERSION "2.1.1259.1"
!define PRODUCT_PUBLISHER "CompanyName"
!define PRODUCT_WEB_SITE "http://www.CompanyName.com"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\${PRODUCT_NAME}"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
Var InDebugMode
Var SQLAccountType
Var SQLUSER
Var SQLPASSWORD
Var SQLSERVER
Var RunInstalls
Var CurrentStep
Var InstallDB
Var SupportedVersions
Var SetupFileName
Var InstallsPath
; MUI 1.67 compatible ------
!include "MUI.nsh"
!include "LogicLib.nsh"
!include "Source\Scripts\DotNetDetect.nsh"
!include "Source\Scripts\WriteToFile.nsh"
!include "Source\Scripts\Page_InstallerPage.nsh"
!include "Source\Scripts\TrimString.nsh"
!include WinMessages.nsh
!include "LogicLib.nsh"
!include "x64.nsh"
!include "Source\Scripts\StrRep.nsh"
!include "Source\Scripts\InstallerControl.nsh"
!include "Source\Scripts\ReplaceInFile.nsh"
!include "Source\Scripts\Debug.nsh"
!include "Source\Scripts\VersionCompare.nsh"
!include "Source\Scripts\CheckWindows.nsh"
!include "Source\Scripts\CheckDotNet4.nsh"
!include "Source\Scripts\CreateShortcuts.nsh"
!include "Source\Scripts\InstallFonts.nsh"
; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
!define UMUI_HEADERIMAGE_BMP "ilaundry-logo.bmp"
!define MUI_BGCOLOR 0xFFFFFF
!define MUI_PAGE_CUSTOMFUNCTION_PRE SkipOnRestart_Licence
!insertmacro MUI_PAGE_LICENSE "Source\Scripts\TAC.TXT"
Page custom Installer_Page_Start Installer_Page_Leave
!include "Source\Scripts\InstallCrystalReports.nsh"
!include "Source\Scripts\UpdateConfigFile.nsh"
!include "Source\Scripts\InstallSqlServer.nsh"
!include "Source\Scripts\InstallDatabase.nsh"
!include "Source\Scripts\InstallDigitalPersona.nsh"
!include "Source\Scripts\InstallAccessDBEngine.nsh"
!include "Source\Scripts\InstallApplication.nsh"
!include "Source\Scripts\InstallBackup.nsh"
!include "Source\Scripts\UninstallSqlServer.nsh"
!include "Source\Scripts\SplashController.nsh"
!define MUI_PAGE_CUSTOMFUNCTION_PRE Skip_Finish
!insertmacro MUI_PAGE_FINISH
; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
; Language files
!insertmacro MUI_LANGUAGE "English"
; MUI end ------
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
InstallDir "$PROGRAMFILES\ApplicationName"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show
Function SkipOnRestart_Licence
${IfNot} $CurrentStep == "new"
Abort
${EndIf}
FunctionEnd
Function Skip_Finish
Abort
FunctionEnd
Function SharedOnInt
InitPluginsDir
File /oname=$PLUGINSDIR\InstallScreen.ini "Source\Scripts\InstallScreen.ini"
StrCpy $InDebugMode 'True'
StrCpy $RunInstalls 'True'
strcpy $StepBeforeReboot "none"
CALL LoadCurrentStep
PUSH 'onInt - Start'
PUSH ''
CALL DumpValues
SetRegView 64
DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce"
SetRegView 32
#call uninstallSQLServer
writeUninstaller $INSTDIR\uninstaller.exe
PUSH 'onInt - End'
PUSH ''
CALL DumpValues
FunctionEnd
Function .onGUIEnd
;Push '$INSTDIR\LogDump.txt'
;Call DumpLog
FunctionEnd
Var UnRegValue
# create a section to define what the uninstaller does.
# the section will always be named "Uninstall"
section "Uninstall"
# Always delete uninstaller first
delete $INSTDIR\uninstaller.exe
ReadRegStr $UnRegValue HKLM "SOFTWARE\${PRODUCT_PUBLISHER}\${PRODUCT_NAME}\${PRODUCT_VERSION}" "InstalledSQL"
${If} $UnRegValue == "true"
call un.uninstallSQLServer
${EndIf}
ReadRegStr $UnRegValue HKLM "SOFTWARE\${PRODUCT_PUBLISHER}\${PRODUCT_NAME}\${PRODUCT_VERSION}" "InstalledCrystalReports"
${If} $UnRegValue == "true"
call un.uninstallSQLServer
${EndIf}
;StrCmp $UnRegValue "true" UninstallSQLServer
sectionEnd
I realize there are a lot of !include but to save question space I left them out for now but if you think the problem may be hidden in one of them I will add that specific .nsh file. Any help would be appreciated in the end.

PRODUCT_VERSION is just a define with no special meaning to the compiler, the VI* attributes are used to set the version information in NSIS.
The version information is stored both in a binary block and as readable strings. The binary block information is controlled by the VIProductVersion and VIFileVersion attributes and the string information is set with VIAddVersionKey. These attributes are not even present in the code you posted so they must be in one of the .nsh files? Perhaps you are setting them in more than one place?
It should look something like this:
!define PRODUCT_VERSION "2.1.1259.1"
!define VERSION "2.1.1259.1"
VIProductVersion "${PRODUCT_VERSION}"
VIFileVersion "${VERSION}"
VIAddVersionKey "FileVersion" "${VERSION}"
VIAddVersionKey "LegalCopyright" "(C) Blah blah Inc."
VIAddVersionKey "FileDescription" "Blah blah blergh fancy app"
If you are still getting the wrong values after verifying that you are not setting the information in multiple places then perhaps Explorer is caching the information. You can inspect the raw version information with a tool like Resource Hacker...

Related

How to set the Focus to a License Agreement Checkbox control using NSIS

I wanted to set the by default Focus to the "License Agreement" checkbox in the License Agreement Page using NSIS. And then the taborder should work.
Please help me how to set the focus?
Below is my code snippet:
!include LogicLib.nsh
!define MUI_TEXT_WELCOME_INFO_TITLE $(welcometitle)
!define MUI_TEXT_WELCOME_INFO_TEXT $(welcometext)
!insertmacro MUI_PAGE_WELCOME
!define MUI_LICENSEPAGE_CHECKBOX ""
!define MUI_INNERTEXT_LICENSE_BOTTOM ""
!define MUI_INNERTEXT_LICENSE_TOP ""
!define MUI_INNERTEXT_LICENSE_BOTTOM_CHECKBOX ""
!define MUI_TEXT_LICENSE_TITLE $(licensetitle)
!define MUI_TEXT_LICENSE_SUBTITLE $(licensesubtitle)
!define MUI_LICENSEPAGE_CHECKBOX_TEXT $(licensecheckboxtext)
!insertmacro MUI_PAGE_LICENSE "C:\Program Files (x86)\NSIS\Docs\Modern UI 2\license.txt"
!define MUI_DIRECTORYPAGE_TEXT_TOP $(mydirtoptext)
!define MUI_TEXT_DIRECTORY_TITLE $(mydirtitle)
!define MUI_TEXT_DIRECTORY_SUBTITLE $(mydirsubtitle)
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!define MUI_TEXT_FINISH_INFO_TITLE $(Finishpagetitle)
!define MUI_TEXT_FINISH_INFO_TEXT $(Finishpagesubtitle)
!define MUI_FINISHPAGE_RUN ""
!define MUI_FINISHPAGE_RUN_TEXT $(FinishonlineReg)
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
!insertmacro MUI_LANGUAGE "English"
; The stuff to install
Section "My TestApp (required)"
SectionEnd
The Windows UI guidelines says:
For keyboard navigation, tab order should flow in a logical order, generally from left to right, top to bottom.
but if you think you must force then you can do this:
!include WinMessages.nsh
!include MUI2.nsh
!insertmacro MUI_PAGE_WELCOME
!define MUI_LICENSEPAGE_CHECKBOX ""
!define MUI_PAGE_CUSTOMFUNCTION_SHOW myForceLicenseFocus
!insertmacro MUI_PAGE_LICENSE "${__FILE__}"
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE English
Function myForceLicenseFocus
!if ${MUI_SYSVERSION} >= 2.0
FindWindow $0 "BUTTON" "" $mui.LicensePage
!else
FindWindow $0 "#32770" "" $hWndParent
FindWindow $0 "BUTTON" "" $0
!endif
System::Call 'USER32::SetFocus(pr0)'
!define /ifndef WM_CHANGEUISTATE 0x127
System::Call 'USER32::PostMessage(pr0,i${WM_CHANGEUISTATE},p0x30002,p0)' ; This forces the checkbox to display the focus rectangle
System::Call 'USER32::SetWindowPos(pr0,p0,i,i,i,i,i0x13)' ; Change tab order
FunctionEnd

NSIS Selections Page

I was originally going to ask how to do several of the features I how have working in the set file. so I have 2 questions now. Patting myself on the back since I figured out everything else:)
Ok so here is what I would like:
Is it possible to have the list taller so no scrolling? also
Can we have the title be just that and no checkbox? (They are radio-buttons and the title is the grouping of them)
How could I go about creating the same thing just in a custom page so I have control over the elements? (including the mouse move over feature of components page)
Thanks for looking and hope you can help me code it out.
Code: (And yes I know the !included's are not all needed in the test buy my app does so I just left it) Also the verification and a few other settings are not finished, I was just getting some examples to work.)
!include WinVer.nsh
!include LogicLib.nsh
!include x64.nsh
!include FileFunc.nsh
!include MUI.nsh
!include WinMessages.nsh
!include InstallOptions.nsh
!include Sections.nsh
!define MUI_COMPONENTSPAGE_TEXT_TOP "Please select the options that best match your setup and preferances."
!define MUI_COMPONENTSPAGE_TEXT_COMPLIST " "
!define MUI_PAGE_HEADER_TEXT "Setup Options"
!define MUI_PAGE_HEADER_SUBTEXT " "
!define MUI_COMPONENTSPAGE_smallDESC
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE "English"
SectionGroup /e "!Sets" SetsTitle #Section Should be Radio Buttons
Section "Set 1" Set1
SectionEnd
Section /o "Set 2" Set2
SectionEnd
Section /o "Skip" SetSkip
SectionEnd
SectionGroupEnd
SubSection /e "!Setup" SetupTitle #Section Should be Radio Buttons
Section "Setup 1" setup1
SectionEnd
Section /o "Setup 2" setup2
SectionEnd
Section /o "None" setupNone
SectionEnd
SubSectionEnd
SubSection /e "!AutoLoad" ALTitle #Section Should be Radio Buttons
Section "Yes" ALYes
SectionEnd
Section /o "No" ALNo
SectionEnd
SubSectionEnd
SubSection /e "!Disable Feature" DFTitle #Section Should be Check Boxes
Section "Feature 1" DAF1
SectionEnd
Section "Feature 2" DAF2
SectionEnd
SubSectionEnd
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SetsTitle} "Sets Description"
!insertmacro MUI_DESCRIPTION_TEXT ${Set1} "Set1 Description"
!insertmacro MUI_DESCRIPTION_TEXT ${Set2} "Set2 Description"
!insertmacro MUI_DESCRIPTION_TEXT ${SetSkip} "SetNone Description"
!insertmacro MUI_FUNCTION_DESCRIPTION_END
Section -InstallSelectedOptions
${If} ${SectionIsSelected} ${set1}
MessageBox MB_OK|MB_USERICON|MB_TOPMOST "set1"
${endif}
${If} ${SectionIsSelected} ${set2}
MessageBox MB_OK|MB_USERICON|MB_TOPMOST "set2"
${endif}
${If} ${SectionIsSelected} ${setskip}
MessageBox MB_OK|MB_USERICON|MB_TOPMOST "setnone"
${endif}
${If} ${Setup1} == true
${endif}
SectionEnd
Function .onInit
StrCpy $1 ${set1} ; Group 1 - Option 1 is selected by default
StrCpy $2 ${setup1} ; Group 2 - Option 1 is selected by default
FunctionEnd
Function .onSelChange
!insertmacro StartRadioButtons $1
!insertmacro RadioButton ${set1}
!insertmacro RadioButton ${set2}
!insertmacro RadioButton ${setskip}
!insertmacro EndRadioButtons
!insertmacro StartRadioButtons $2
!insertmacro RadioButton ${setup1}
!insertmacro RadioButton ${setup2}
!insertmacro RadioButton ${setupNone}
!insertmacro EndRadioButtons
FunctionEnd
You cannot combine radio buttons and checkmarks on the built-in components page but you can use your own custom radio button .BMP file with !define MUI_COMPONENTSPAGE_CHECKBITMAP "myradio.bmp".
You can customize the MUI components page a little bit by defining MUI_COMPONENTSPAGE_SMALLDESC or MUI_COMPONENTSPAGE_NODESC but if you need more than that you have to copy and modify "...\NSIS\Contrib\UIs\modern.exe" with Resource Hacker and apply this custom UI with MUI_UI.
Replicating the components page as a custom page might be possible but it is a lot of work. nsDialogs does not have much support for the TreeView control so you are pretty much on your own if you go down this route.

NSIS nsDialog has disabled back/next/cancel buttons?

I'm following the NSIS nsDialog tutorial with a goal to gather some user input I will use to write into a config file later. The NSISEclipse plugin has generated an MUI2 template that has gotten me started and successfully installs the files.
I have used the nsDialog tutorial to generate a dialog that does get emitted exactly where I want it to, but for some reason the "Back/Next/Cancel" buttons are all grey. I don't see where in the nsDialog documentation it says to enable/disable those buttons.
Here's my code:
Var Dialog
Var Label
Var MyTextBox
Section configLocationDialog
nsDialogs::Create 1018
Pop $Dialog
${If} $Dialog == error
Abort
${EndIf}
${NSD_CreateLabel} 0 0 100% 12u "Hello, welcome to nsDialogs!"
Pop $Label
${NSD_CreateText} 10% 20u 80% 12u "Hello World"
Pop $MyTextbox
nsDialogs::Show
SectionEnd
And, the dialog once displayed:
What do I need to change to tell NSIS to allow back/next/cancel?
EDIT More code was asked for. Here's the whole thing as it exists now.
# Auto-generated by EclipseNSIS Script Wizard
# Dec 19, 2013 3:48:34 PM
Name SecureKeypad
# General Symbol Definitions
!define REGKEY "SOFTWARE\$(^Name)"
!define VERSION 1.0.0
!define COMPANY **COMPANY**
!define URL http://www.**COMPANY**.com
# MultiUser Symbol Definitions
!define MULTIUSER_EXECUTIONLEVEL Standard
!define MULTIUSER_INSTALLMODE_COMMANDLINE
!define MULTIUSER_INSTALLMODE_INSTDIR $PROGRAMFILES\SecureKeypad
!define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY "${REGKEY}"
!define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUE "Path"
# MUI Symbol Definitions
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install-colorful.ico"
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
!define MUI_STARTMENUPAGE_NODISABLE
!define MUI_STARTMENUPAGE_REGISTRY_KEY ${REGKEY}
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME StartMenuGroup
!define MUI_STARTMENUPAGE_DEFAULTFOLDER SecureKeypad
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall-colorful.ico"
!define MUI_UNFINISHPAGE_NOAUTOCLOSE
# Included files
#!include MultiUser.nsh
!include LogicLib.nsh
!include nsDialogs.nsh
!include AdvReplaceInFile.nsh
!include Sections.nsh
!include MUI2.nsh
# Variables
Var StartMenuGroup
# Installer pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
# Installer languages
!insertmacro MUI_LANGUAGE English
# Installer attributes
OutFile setup.exe
CRCCheck on
InstallDir $PROGRAMFILES\${COMPANY}\SecureKeypad
XPStyle on
ShowInstDetails show
VIProductVersion 1.0.0.0
VIAddVersionKey ProductName SecureKeypad
VIAddVersionKey ProductVersion "${VERSION}"
VIAddVersionKey CompanyName "${COMPANY}"
VIAddVersionKey CompanyWebsite "${URL}"
VIAddVersionKey FileVersion "${VERSION}"
VIAddVersionKey FileDescription ""
VIAddVersionKey LegalCopyright ""
InstallDirRegKey HKLM "${REGKEY}" Path
ShowUninstDetails show
# Input dialogs
Var Dialog
Var Label
Var MyTextbox
#Page custom configLocationDialog configLocationDialogLeave
#Page custom doConfiguration
Section configLocationDialog
nsDialogs::Create 1018
Pop $Dialog
${If} $Dialog == error
Abort
${EndIf}
GetFunctionAddress $0 "configLocationDialogLeave"
nsDialogs::OnBack $Dialog $0
#nsDialogs::OnNext $Dialog
${NSD_CreateLabel} 0 0 100% 12u "Hello, welcome to nsDialogs!"
Pop $Label
${NSD_CreateText} 10% 20u 80% 12u "Hello World"
Pop $MyTextbox
nsDialogs::Show
SectionEnd
Function configLocationDialogLeave
${NSD_GetText} $MyTextbox $0
MessageBox mb_ok $0
FunctionEnd
# Installer sections
Section -Main SEC0000
SetOutPath $INSTDIR
SetOverwrite on
File installable-content\CYBSSecurity.dll
File installable-content\SecureKeypad.exe
File installable-content\SecureKeypad.exe.config
File installable-content\SecureKeypad.config
File installable-content\SecureKeypad.frmSecureKeypad.resources
WriteRegStr HKLM "${REGKEY}\Components" Main 1
!insertmacro AdvReplaceInFile $INSTDIR\SecureKeypad.exe.config "##configFile##" $INSTDIR
SectionEnd
Section -post SEC0001
WriteRegStr HKLM "${REGKEY}" Path $INSTDIR
SetOutPath $INSTDIR
WriteUninstaller $INSTDIR\uninstall.exe
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
SetOutPath $SMPROGRAMS\$StartMenuGroup
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name).lnk" $INSTDIR\uninstall.exe
!insertmacro MUI_STARTMENU_WRITE_END
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "${VERSION}"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Publisher "${COMPANY}"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" URLInfoAbout "${URL}"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayIcon $INSTDIR\uninstall.exe
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" UninstallString $INSTDIR\uninstall.exe
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoModify 1
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoRepair 1
SectionEnd
# Macro for selecting uninstaller sections
!macro SELECT_UNSECTION SECTION_NAME UNSECTION_ID
Push $R0
ReadRegStr $R0 HKLM "${REGKEY}\Components" "${SECTION_NAME}"
StrCmp $R0 1 0 next${UNSECTION_ID}
!insertmacro SelectSection "${UNSECTION_ID}"
GoTo done${UNSECTION_ID}
next${UNSECTION_ID}:
!insertmacro UnselectSection "${UNSECTION_ID}"
done${UNSECTION_ID}:
Pop $R0
!macroend
# Uninstaller sections
Section /o -un.Main UNSEC0000
Delete /REBOOTOK $INSTDIR\SecureKeypad.frmSecureKeypad.resources
Delete /REBOOTOK $INSTDIR\SecureKeypad.exe.config
Delete /REBOOTOK $INSTDIR\SecureKeypad.exe
Delete /REBOOTOK $INSTDIR\<sensored>.dll
DeleteRegValue HKLM "${REGKEY}\Components" Main
SectionEnd
Section -un.post UNSEC0001
DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)"
Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name).lnk"
Delete /REBOOTOK $INSTDIR\uninstall.exe
DeleteRegValue HKLM "${REGKEY}" StartMenuGroup
DeleteRegValue HKLM "${REGKEY}" Path
DeleteRegKey /IfEmpty HKLM "${REGKEY}\Components"
DeleteRegKey /IfEmpty HKLM "${REGKEY}"
RmDir /REBOOTOK $SMPROGRAMS\$StartMenuGroup
RmDir /REBOOTOK $INSTDIR
SectionEnd
# Installer functions
Function .onInit
InitPluginsDir
FunctionEnd
# Uninstaller functions
Function un.onInit
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuGroup
!insertmacro SELECT_UNSECTION Main ${UNSEC0000}
FunctionEnd
Calling nsDialogs::Create/Show in a section is never valid, they can only be called in the create callback function of a custom page.
Some buttons will be disabled after the instfiles page (Already installed, cannot cancel or go back) but this is done by NSIS itself, not nsDialogs...
If you put your call to nsDialogs:Create in a section it will be run when the installer is installing files and such. In that state you won't be able to keep navigating through the pages in the installer and you are stuck.
Your notice about your custom page running at the end of the installer is really what you should be trying to fix, not dismissing it as the wrong way (it's the only way). NSIS-scripts are quite simple in many ways. For example, pages are loaded in the order that they are declared. So when you declare that you want MUI_PAGE_WELCOME, MUI_PAGE_DIRECTORY and the others you are also setting the order of them.
# Installer pages
!insertmacro MUI_PAGE_WELCOME # First page
!insertmacro MUI_PAGE_DIRECTORY # Second page
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup # Third page
!insertmacro MUI_PAGE_INSTFILES # Etc
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
So if you then try to keep all your code together and add your custom page alongside the functions that handle it, it will undoubtedly be the last page in that order.
# Installer pages
!insertmacro MUI_PAGE_WELCOME # First page
!insertmacro MUI_PAGE_DIRECTORY # Second page
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup # Third page
...
# Input dialogs
Var Dialog
Var Label
Var MyTextbox
Page custom configLocationDialog configLocationDialogLeave # Last page
Section configLocationDialog
nsDialogs::Create 1018
Pop $Dialog
So to illustrate this I took your code and brewed it down to basically the page you wanted.
# Included files
!include LogicLib.nsh
!include nsDialogs.nsh
!include Sections.nsh
!include MUI2.nsh
# Installer pages
!insertmacro MUI_PAGE_WELCOME # First page
Page custom configLocationDialog configLocationDialogLeave # Second page!
!insertmacro MUI_PAGE_FINISH # Last page
# Installer languages
!insertmacro MUI_LANGUAGE English
# Input dialogs
Var Dialog
Var Label
Var MyTextbox
Function configLocationDialog
nsDialogs::Create 1018
Pop $Dialog
${If} $Dialog == error
Abort
${EndIf}
GetFunctionAddress $0 "configLocationDialogLeave"
nsDialogs::OnBack $Dialog $0
${NSD_CreateLabel} 0 0 100% 12u "Hello, welcome to nsDialogs!"
Pop $Label
${NSD_CreateText} 10% 20u 80% 12u "Hello World"
Pop $MyTextbox
nsDialogs::Show
FunctionEnd
Function configLocationDialogLeave
${NSD_GetText} $MyTextbox $0
MessageBox mb_ok $0
FunctionEnd
Section -Main SEC0000
SectionEnd
The NSISEclipse plugin generates a lot of code, including a set of macros that execute the various pages that are displayed:
# Installer pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
The trick is to inject the page call at the right step.
# Installer pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup
Page custom configLocationDialog configLocationDialogLeave
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES

NSIS - add CreateText to MUI FINISH PAGE

I have an NSIS installer which at completion of the install sends an e-mail with a couple different logs attached. I'd like to allow the user to add their e-mail address to receive the e-mail and I'd like for them to enter it on the finish page because it seem most appropriate. How can I add a text box on the finish page for the user to enter their e-mail address into?
Here is my current finish page:
;Finish page
!Define MUI_FINISHPAGE_RUN
!Define MUI_FINISHPAGE_RUN_TEXT 'Open Install Log'
!Define MUI_FINISHPAGE_RUN_NOTCHECKED
!define MUI_FINISHPAGE_RUN_FUNCTION 'LaunchLog'
!define MUI_FINISHPAGE_LINK 'Click here to visit us at co.com.'
!define MUI_FINISHPAGE_LINK_LOCATION http://www.co.com/
!define MUI_FINISHPAGE_TEXT_LARGE
!define MUI_FINISHPAGE_TEXT "text text text"
!insertmacro MUI_PAGE_FINISH
!include MUI2.nsh ;If you are using MUI v1 you need to replace NSD_* with .ini file commands
!include Logiclib.nsh
...
!ifndef EM_SETCUEBANNER
!define EM_SETCUEBANNER 0x1501 ; NT5 w/Themes & Vista+
!endif
Var EMailEdit
Function CustomizeFinishPage
${NSD_CreateText} 120u 144u 180u 12u ""
Pop $EMailEdit
System::Call 'USER32::SendMessage(i$EMailEdit,i${EM_SETCUEBANNER},i0,w"E-mail address goes here...")'
FunctionEnd
Function SendFinishMail
${NSD_GetText} $EMailEdit $0
${If} $0 == "" ; TODO: Verify address by at least checking for *#*.*
MessageBox mb_iconstop "You must enter a valid address!"
Abort
${EndIf}
MessageBox mb_ok "TODO: Send mail to: $0"
FunctionEnd
...
!insertmacro MUI_PAGE_*
;Finish page
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_TEXT 'Open Install Log'
!define MUI_FINISHPAGE_RUN_NOTCHECKED
!define MUI_FINISHPAGE_RUN_FUNCTION 'LaunchLog'
!define MUI_FINISHPAGE_SHOWREADME "" #Used as our email checkbox
!define MUI_FINISHPAGE_SHOWREADME_TEXT "E-mail me some crap:"
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION SendFinishMail
!define MUI_FINISHPAGE_LINK 'Click here to visit us at co.com.'
!define MUI_FINISHPAGE_LINK_LOCATION http://www.co.com/
!define MUI_FINISHPAGE_TEXT_LARGE
!define MUI_FINISHPAGE_TEXT "text text text"
!define MUI_PAGE_CUSTOMFUNCTION_SHOW CustomizeFinishPage
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE English

NSIS Change Header Image Based on Language Selection

I am using NSIS to create an installer. How can I change the header image (MUI_HEADERIMAGE_BITMAP) based on the users language selection at install?
!define MUI_HEADERIMAGE
!define MUI_CUSTOMFUNCTION_GUIINIT myGuiInit
!include MUI2.nsh
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_COMPONENTS
...
!insertmacro MUI_LANGUAGE English
!insertmacro MUI_LANGUAGE Swedish
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd
Function myGUIInit
InitPluginsDir
${If} ${LANG_ENGLISH} = $Language
File "/oname=$PluginsDir\langspecifichdr.bmp" "${NSISDIR}\Contrib\Graphics\Header\orange.bmp"
${Else}
File "/oname=$PluginsDir\langspecifichdr.bmp" "${NSISDIR}\Contrib\Graphics\Header\win.bmp"
${EndIf}
SetBrandingImage /IMGID=1046 "$PluginsDir\langspecifichdr.bmp"
FunctionEnd

Resources