Raj
Raj

Reputation: 537

How to hide the pages while continue installation in NSIS script

I have working installer for my application in NSIS. It has several pages like license, directory, installfiles and finish. Now what I wanted to do is, hide all the pages but continue the installation based on some condition. I tried using Abort/MUI_PAGE_CUSTOMFUNCTION_PRE but it terminated the further installation. Any pointers here?

Upvotes: 0

Views: 2354

Answers (3)

Anders
Anders

Reputation: 101569

You have to skip pages in the pre callback:

!include FileFunc.nsh
!include LogicLib.nsh
!include MUI2.nsh
!define MUI_PAGE_CUSTOMFUNCTION_PRE maybeskippages
!insertmacro MUI_PAGE_WELCOME
!define MUI_PAGE_CUSTOMFUNCTION_PRE maybeskippages
!insertmacro MUI_PAGE_LICENSE "${__FILE__}"
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"

Var SkipPages
Function .onInit
${GetParameters} $0
${GetOptions} "$0" "/Skip"  $1
${IfNot} ${Errors}
    StrCpy $SkipPages 1
${EndIf}
FunctionEnd

Function maybeskippages
${If} $SkipPages > 0 
    Abort
${EndIf}
FunctionEnd

Upvotes: 2

Slappy
Slappy

Reputation: 5472

Use Abort in your MUI_PAGE_CUSTOMFUNCTION_SHOW to skip this page.

Maybe you could try NSIS forums, there is plenty of similar questions and you get quickier answers.

Upvotes: 0

Nahar
Nahar

Reputation: 255

You could use SetSilent silent within .onInit function to hide the UI. Or you could use MUI_PAGE_CUSTOMFUNCTION_PRE hook function and with ShowWindow also.

Upvotes: 0

Related Questions