Search code examples
nsis

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.

  1. For Installation Option the text should be "Installation completed"
  2. For UnInstallation Option the text should be "UnInstallation Completed"

Thanks in advance for your help on this.


Solution

  • 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