How to change the Header info (text) in NSIS at run time? - nsis

I am using NSIS i.e., null soft to create a windows installer. All working fine, but I need to change the header info text while installer is running.
For example:
In header info Now I am getting as follows,
Installing, Please wait while...
But I need to change this info or text like Please wait... or any text. Herewith I have attached the screenshot and marked in red color. Please suggest some solution.

!include MUI.nsh
!insertmacro MUI_PAGE_COMPONENTS
!define MUI_PAGE_HEADER_TEXT "Blah blah"
!define MUI_PAGE_HEADER_SUBTEXT "Sub blah blah"
#!define MUI_INSTFILESPAGE_FINISHHEADER_TEXT "Blah blah completed" ; You only need this if MUI_PAGE_INSTFILES is the last page
#!define MUI_INSTFILESPAGE_FINISHHEADER_SUBTEXT "Sub blah blah"
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE English
Edit: And to change it during the install process:
Section
!insertmacro MUI_HEADER_TEXT "Hello" "world"
Sleep 3333
!insertmacro MUI_HEADER_TEXT "Still" "there?"
Sleep 3333
SectionEnd

Related

trying to make two different buttons for restart & restart later in NSIS

As i am working with the NSIS code, i was trying to make two different buttons for restart & restart later in NSIS. Based on the nsis Docuementaion
we need to use following commands(MUI_FINISHPAGE_TEXT_REBOOTNOW,MUI_FINISHPAGE_TEXT_REBOOTLATER)
But i was getting an error called "macro named MUI_FINISHPAGE_TEXT_REBOOTNOW. not found". Could you plese let me know how can we do this tricky task.
!define MUI_FINISHPAGE_TEXT_REBOOTNOW "Yes, restart the computer now"
!define MUI_FINISHPAGE_TEXT_REBOOTLATER "No, I will restart the computer later"
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_FINISHPAGE_TEXT_REBOOTNOW
!insertmacro MUI_FINISHPAGE_TEXT_REBOOTLATER
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
; MUI end ------
Section test
SectionEnd
Those are defines to customize the page, not macros you can call.
!include MUI2.nsh
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_REBOOTLATER_DEFAULT ; Make "later" the default option
!define MUI_FINISHPAGE_TEXT_REBOOTNOW "Reboot now!!!!" ; Custom text
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE English
Section
Sleep 2222
SetRebootFlag True # Pretend we did something that requires a reboot
SectionEnd

Finish page sometimes showing reboot option even after customized the the screen to show title and description in NSIS

I customized my Finish page like as shown below in MyEnglish.nsh file.
LangString Finishpagetitle ${LANG_ENGLISH} "Completed the ${ApplicationName} Setup Wizard"
LangString Finishpagesubtitle ${LANG_ENGLISH} "Click the Finish button to exit the Setup Wizard"
And written the below code in my MainFile.ini file like as shown below:
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE
!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 ""
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE "English"
Normally I am seeing the finish dialog with the above customized title and text.
But sometimes, I am getting the different Finish window with below text:
"Your computer must be restarted in order to complete the installation of $(^NameDA). Do you want to reboot now?"
with two radio buttons "Reboot now" and "I want to manually reboot later"
Why it is showing the reboot dialog?
If you use the /RebootOK switch on some of the file commands and the installer detects that a file is locked it will ask the user to reboot.

How to change the Directory Destination folder text using NSIS?

I customized the directory destination folder text using the below code snippet in English.nsh file
!define MUI_TEXT_DIRECTORY_TITLE "Destination Folder"
!define MUI_TEXT_DIRECTORY_SUBTITLE "Click Install to install to the default folder or click Browse to choose another"
But I need to change the highlighted text that is showing as "Destination Folder" to "Install EMR to:"
Here the title should be as it is like how it is showing ("Destination Folder")
How to set the highlighted text (Destination Folder) to different text ("Install EMR to:")?
I followed the below link to fix the issue but even with that also i am getting the "Destination Folder" text two times.
Change the text of install folder page in NSIS
Below is my complete code:
CustomEngilish.nsh
!define MUI_TEXT_DIRECTORY_TITLE "Destination Folder"
!define MUI_TEXT_DIRECTORY_SUBTITLE "Click Install to install to the default folder or click Browse to choose another"
!define MUI_DIRECTORYPAGE_TEXT_TOP "Install EMR to:"
!define MUI_DIRECTORYPAGE_TEXT_DESTINATION "Install EMR to:"
!insertmacro MUI_LANGUAGE "English"
Mysetup.nsi
!define MUI_PAGE_CUSTOMFUNCTION_SHOW MyDirectoryShowCallback
!insertmacro MUI_PAGE_DIRECTORY
!include "CustomEnglish.nsh"
Function MyDirectoryShowCallback
StrCpy $PageId 3
SendMessage $mui.DirectoryPage.Text ${WM_SETTEXT} 0 "STR:$(MUI_TEXT_DIRECTORY_TITLE)"
SendMessage $mui.DirectoryPage.Text ${WM_SETTEXT} 0 "STR:$(MUI_TEXT_DIRECTORY_SUBTITLE)"
SendMessage $mui.DirectoryPage.Text ${WM_SETTEXT} 0 "STR:$(MUI_DIRECTORYPAGE_TEXT_TOP)"
SendMessage $mui.DirectoryPage.Text ${WM_SETTEXT} 0 "STR:$(MUI_DIRECTORYPAGE_TEXT_DESTINATION)"
FunctionEnd
MUI_TEXT_DIRECTORY_TITLE is the text in the top header, you want MUI_DIRECTORYPAGE_TEXT_TOP and it needs to point to a custom language string when using multiple languages:
!include "MUI2.nsh"
!insertmacro MUI_PAGE_WELCOME
!define MUI_DIRECTORYPAGE_TEXT_TOP $(mydirtoptext)
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
; CustomSwedish.nsh:
!insertmacro MUI_LANGUAGE "Swedish"
LangString mydirtoptext ${LANG_SWEDISH} "Swedish bork bork"
; CustomEnglish.nsh:
!insertmacro MUI_LANGUAGE "English"
LangString mydirtoptext ${LANG_ENGLISH} "English blah blah"
In your screenshot the top area is gray but it should normally be white, this often indicates a problem with the order of your MUI_PAGE and MUI_LANGUAGE macros. All languages must come after the pages.

How to display a custom text on MUI_PAGE_INSTFILES in NSIS

I am beginner in NSIS, and I want to display the custom text in MUI_PAGE_INSTFILES page as I have two options in Components page 1. Installation and 2. UnInstallation.
So when I choose Below options I am expecting the corresponding text in MUI_PAGE_INSTFILES page.
For Installation Option the text should be "Installation completed"
For UnInstallation Option the text should be "UnInstallation Completed"
Thanks in advance for your help on this.
The CompletedText attribute supports variables:
var mycompletedtext
var myfinishsubtext
CompletedText $mycompletedtext
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_COMPONENTS
!define MUI_INSTFILESPAGE_FINISHHEADER_TEXT "$mycompletedtext"
!define MUI_INSTFILESPAGE_FINISHHEADER_SUBTEXT "$myfinishsubtext"
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
Section Installer
StrCpy $mycompletedtext "Installation completed"
StrCpy $myfinishsubtext "Something something"
SectionEnd
Section Uninstaller
StrCpy $mycompletedtext "UnInstallation Completed"
StrCpy $myfinishsubtext "Bye bye"
SectionEnd

NSIS Change page text fails

I want to change the texts in the installer pages like MUI_WELCOMEPAGE_TITLE.
But it doesn't work. Can someone please give me a hint?
The standard text is displayed.
!include "FileFunc.nsh"
!include "Library.nsh"
!include "UMUI.nsh"
!include "MUI2.nsh"
!include "WordFunc.nsh"
!define MUI_WELCOMEPAGE_TITLE $(MUI_TEXT_WELCOME_INFO_TITLE_INFINGY)
$(xyz) is a LangString, use ${mydefine} if you used !define mydefine "Title goes here".
You can also use a LangString:
!define MUI_WELCOMEPAGE_TITLE "$(MyWelcomeTitle)"
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE English
LangString MyWelcomeTitle ${LANG_ENGLISH} "Hello World"

Resources