Search code examples
nsis

trying to make two different buttons for restart & restart later in NSIS


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


Solution

  • 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