简体   繁体   中英

How to change MUI_INSTFILESPAGE_FINISHHEADER_SUBTEXT if exists two MUI_PAGE_INSTFILES

I have managed to customize the message shown in the title / subtitle after installation:

!define APP_NAME 'Test15'

name ${APP_NAME}
outfile '${APP_NAME}.exe'
showinstdetails show
InstallDir '$PROGRAMFILES\${APP_NAME}'

!include 'mui.nsh'

Var CompletedText
CompletedText $CompletedText


Var MUI_HeaderText
Var MUI_HeaderSubText
!define MUI_INSTFILESPAGE_FINISHHEADER_TEXT "$MUI_HeaderText"
!define MUI_INSTFILESPAGE_FINISHHEADER_SUBTEXT "$MUI_HeaderSubText"


!insertmacro MUI_PAGE_INSTFILES

!insertmacro MUI_LANGUAGE "English"


Section "One"
    MessageBox MB_OK "Section One"
SectionEnd



Section -"Post"
  ;MessageBox MB_OK "Section Post"
  StrCpy $CompletedText "My custom text"
  StrCpy $MUI_HeaderText "My custom header text"
  StrCpy $MUI_HeaderSubText "My custom header subText"
  ;MessageBox MB_OK "OUTING Section Post"
SectionEnd

My problem is that when I need to add a second part installation ( it is a new mandatory requirement ), and then not get modify / customize messages title / subtitle shown at the end:

!define APP_NAME 'Test15'

name ${APP_NAME}
outfile '${APP_NAME}.exe'
showinstdetails show
InstallDir '$PROGRAMFILES\${APP_NAME}'

!include 'mui.nsh'

Var CompletedText
CompletedText $CompletedText


Var MUI_HeaderText
Var MUI_HeaderSubText
!define MUI_INSTFILESPAGE_FINISHHEADER_TEXT "$MUI_HeaderText"
!define MUI_INSTFILESPAGE_FINISHHEADER_SUBTEXT "$MUI_HeaderSubText"


!insertmacro MUI_PAGE_INSTFILES

;This my second part instalation!!
!insertmacro MUI_PAGE_INSTFILES

!insertmacro MUI_LANGUAGE "English"


Section "One"
   MessageBox MB_OK "Section One"
SectionEnd



Section -"Post"
  ;MessageBox MB_OK "Section Post"
  StrCpy $CompletedText "My custom text"
  StrCpy $MUI_HeaderText "My custom header text"
  StrCpy $MUI_HeaderSubText "My custom header subText"
  ;MessageBox MB_OK "OUTING Section Post"
SectionEnd

Now, the same message is always displayed at the end for Title/Subtitle: "Installation Complete" // "Setup was completed successfully.". Nevertheless, the 'completed' text value is modified successfully ("My custom text").

Please, can anyone help me?

Thanks in advance!

If you read the MUI documentation carefully you will find this in the "Page settings" section:

Page settings apply to a single page and should be set before inserting a page macro. The same settings can be used for installer and uninstaller pages. You have to repeat the setting if you want it to apply to multiple pages .

Only the defines listed under "Interface settings" are global.

!include MUI.nsh
!define MUI_PAGE_HEADER_TEXT "Install page #1"
!define MUI_PAGE_HEADER_SUBTEXT "Foo foo foo"
!define MUI_INSTFILESPAGE_FINISHHEADER_TEXT "Did part 1"
!define MUI_INSTFILESPAGE_FINISHHEADER_SUBTEXT "..."
!insertmacro MUI_PAGE_INSTFILES
!define MUI_PAGE_HEADER_TEXT "Install page #2"
!define MUI_PAGE_HEADER_SUBTEXT "Bar bar bar!"
!define MUI_INSTFILESPAGE_FINISHHEADER_TEXT "All done"
!define MUI_INSTFILESPAGE_FINISHHEADER_SUBTEXT "ZZZzzz.."
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM