For my installation i have added new custom page. It comes after MUI_PAGE_INSTFILES. But before this custom page was not there. The problem is that after adding this custom page,it has effected finish page and finish page now has back button enabled.Before it was disabled(I have not done any coding before to disable back button). But after adding new custom page finish page has back button enabled.
I have below order of pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "${Stpath}read me.txt"
!define MUI_PAGE_CUSTOMFUNCTION_PRE wel_pre
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE DirectoryPageLeave
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
Page custom InstallPageCreate checkinstdir
!define MUI_FINISHPAGE_RUN "$INSTDIR\setupx.exe"
!define MUI_FINISHPAGE_RUN_PARAMETERS ""
!define MUI_PAGE_CUSTOMFUNCTION_PRE welfinish
!define MUI_PAGE_CUSTOMFUNCTION_SHOW FinishPageShow
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE myleave
!insertmacro MUI_PAGE_FINISH
Before the line Page custom InstallPageCreate checkinstdir was not there and finish page does not had back button enabled.
After adding that custom page back button in finish page is enabled.The custom page is shown only when certain command line is passed to installer. So if no command line is passed for my setup.exe then after MUI_PAGE_INSTFILES, finish page comes.If user clicks on back button then again MUI_PAGE_INSTFILES is shown and files will copy to install directory. Also if that custom page appears then that page has back button disabled, which is proper.
Also i need to know where this back button disable is done? Is it done in macro MUI_PAGE_INSTFILES(nsis builtin macro)?
So i need to disable back button in finish page. Please help
There is some code in makensis.exe (CEXEBuild::ProcessPages) that sets a flag on the page: p->flags |= PF_BACK_ENABLE; and code in UI.c checks this flag. To override this use the page show callback function:
Function InstallPageCreate
StartMenu::Init /autoadd "Dummy page"
StartMenu::Show
FunctionEnd
!include MUI2.nsh
!insertmacro MUI_PAGE_INSTFILES
Page custom InstallPageCreate
!define MUI_FINISHPAGE_RUN "$INSTDIR\setupx.exe"
!define MUI_FINISHPAGE_RUN_PARAMETERS ""
!define MUI_PAGE_CUSTOMFUNCTION_SHOW FinishPageShow
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE English
Function FinishPageShow
GetDlgItem $0 $HWNDPARENT 3
EnableWindow $0 0
FunctionEnd
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 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.
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