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
Related
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
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.
I have two MUI_PAGE_DIRECTORY pages. The first stores the entered data to the default, $INSTDIR. What I would like to do is copy the value in $INSTDIR to the defined var $DataDir so that before the second directory page is displayed, $DataDir becomes $INSTDIR\Data. When the second page is displayed I would like the default value to be $INSTDIR\Data.
Is this possible?
InstallDir $ProgramFiles\MyApp
Var DataDir
!include MUI2.nsh
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE InstDirPageLeave
!insertmacro MUI_PAGE_DIRECTORY
!define MUI_DIRECTORYPAGE_VARIABLE $DataDir
!define MUI_DIRECTORYPAGE_TEXT_TOP "Choose Data directory for bla bla bla..."
!define MUI_DIRECTORYPAGE_TEXT_DESTINATION "Data Directory:"
!define MUI_PAGE_CUSTOMFUNCTION_SHOW DataDirShowPage
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE English
Function InstDirPageLeave
StrCpy $DataDir "$InstDir\Data"
FunctionEnd
Function DataDirShowPage
!insertmacro MUI_HEADER_TEXT "Foo" "Bar"
FunctionEnd
Section
DetailPrint $InstDir
DetailPrint $DataDir
SectionEnd
What are you trying to achieve?
If you want to install some files into two separate locations use MUI_PAGE_DIRECTORY and custom nsDialogs page (with browse folder button) so user can pick up two directories.
If your location is always $INSTDIR and second is somewhere inside it ($INSTDIR\some\data\path) then you only need to append your inside path to $INSTDIR - there is no need to show dialog twice and select path twice.
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