nsisuninstallationnsis-mui

Custom texts for uninstaller


So I made patch installer for certain game. It works nicely, dumb design decisions of NSIS notwithstanding. I use NSIS 3.03 with MUI2.

Due to nature of patch (it is not separate application, just patch applied on already existing program) I had to use pretty much all custom texts for installer (like MUI_WELCOMEPAGE_TITLE, MUI_WELCOMEPAGE_TEXT etc). Grammar of my native language didn't helped.

But then I foolishly wanted to include uninstaller. While it works, it seems like there are almost no custom texts for it. Only ones that work are MUI_UNCONFIRMPAGE_TEXT_TOP and MUI_UNCONFIRMPAGE_TEXT_LOCATION. Other default texts for uninstallator look like crap due to aforementioned issues (patch instead of real app, grammar).

For example, on welcome page of uninstaller there is text similar to "Before starting the uninstallation, make sure [NAME OF PATCH TO GAME] is not running.". It should be something like "Before starting the uninstallation, make sure [NAME OF GAME, NOT NAME OF PATCH] is not running.". No, there is no MUI_UNWELCOMEPAGE_TEXT or anything like that.

How to change other texts in uninstaller? This kind of oversight is silly for 10 year old installer creator on its third major version. WTF?


Solution

  • From the documentation:

    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.

    !include MUI2.nsh
    !define MUI_WELCOMEPAGE_TEXT "Installer blah blah"
    !insertmacro MUI_PAGE_WELCOME
    !insertmacro MUI_PAGE_DIRECTORY
    !insertmacro MUI_PAGE_INSTFILES
    !define MUI_WELCOMEPAGE_TEXT "Uninstaller blah blah"
    !insertmacro MUI_UNPAGE_WELCOME
    !insertmacro MUI_UNPAGE_INSTFILES
    !insertmacro MUI_LANGUAGE "English"
    
    Section
    SetOutPath "$InstDir"
    WriteUninstaller "$InstDir\Un.exe"
    ExecShell "" "$InstDir\Un.exe"
    SectionEnd
    
    Section Uninstall
    Delete "$InstDir\Un.exe"
    RMDir "$InstDir"
    SectionEnd