Archive: How to hide the pages while continue installation in NSIS script


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?


Use Abort in MUI_PAGE_CUSTOMFUNCTION_SHOW to skip this page.


Thanks for reply T.Slappy :). If I am not wrong I have to use MUI_PAGE_CUSTOMFUNCTION_SHOW for all the pages which I wanted to hide. Is my understanding correct?


To skip a page, call abort in its SHOW function. If you want to skip multiple pages, either call abort in each page's SHOW function, or use a relative jump: http://nsis.sourceforge.net/Go_to_a_NSIS_page

I recommend using the abort method if you can, it's simpler and more robust.


I tried using Abort in MUI_PAGE_CUSTOMFUNCTION_SHOW, but still pages were shown :(
Is there any other way to hide the pages while continuing the installation?


Here is the code I tried:
!define MUI_PAGE_CUSTOMFUNCTION_SHOW NoWizardFunc_SHOW
!insertmacro MUI_PAGE_LICENSE $(MUILicense)
!define MUI_PAGE_CUSTOMFUNCTION_SHOW NoWizardFunc_SHOW
!insertmacro MUI_PAGE_INSTFILES

Function NoWizardFunc_SHOW
MessageBox MB_OK "$NOWIZARD"

${IF} $NOWIZARD == 1
Abort
${ENDIF}


First of all, make sure the value of $NOWIZARD is actually 1: Add a MessageBox inside the if statement.

Second... hmm, I do think it's legal to use the same function twice. But try using different functions for each page.

(btw, NSIS is case insensitive, so ${If}, {$IF} and ${if} are the same.)


You should be calling Abort in the page's pre function, not its show function. It may work in the show function too but the manual only mentions its use in the pre function. This is different for custom pages of course.

Stu


@MSG: I have expected value as 1 for $NOWIZARD. And I tried different functions for different pages but still no Luck.
I tried Aborting it in PRE Callbacks, it skipped the pages but installation didn't happen.
Am not getting what I am missing here :( What all I want is non-silent installer to behave silent based on some condition..


If you want to make the entire installer silent based on a condition, use SetSilent in .onInit. If you are skipping the instfiles page then of course nothing will be installed!

Stu


I used SetSilent in .onInit, installation was successful but it didn't hide the pages, all pages were shown. I want to hide the pages but installation should be successful.


Something is wrong with your code if SetSilent isn't working.

Stu