- NSIS Discussion
- How to hide the pages while continue installation in NSIS script
Archive: How to hide the pages while continue installation in NSIS script
rajesh.sabale
22nd December 2011 01:56 UTC
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?
T.Slappy
22nd December 2011 05:57 UTC
Use Abort in MUI_PAGE_CUSTOMFUNCTION_SHOW to skip this page.
rajesh.sabale
22nd December 2011 17:28 UTC
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?
MSG
22nd December 2011 17:36 UTC
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.
rajesh.sabale
22nd December 2011 20:58 UTC
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?
rajesh.sabale
22nd December 2011 21:06 UTC
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}
MSG
23rd December 2011 07:33 UTC
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.)
Afrow UK
23rd December 2011 13:12 UTC
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
rajesh.sabale
23rd December 2011 23:39 UTC
@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..
Afrow UK
24th December 2011 11:49 UTC
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
rajesh.sabale
23rd January 2012 18:09 UTC
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.
Afrow UK
23rd January 2012 19:27 UTC
Something is wrong with your code if SetSilent isn't working.
Stu