- NSIS Discussion
- Conditional standard pages
Archive: Conditional standard pages
sylvinhio
30th April 2009 13:50 UTC
Conditional standard (built-in) pages
Hello,
In my installer, I've got standard pages, and custom pages called like that:
!insertmacro MUI_PAGE_WELCOME
Page Custom ChoixTypeInstall ChoixTypeInstallLeave " : Choix type installation"
Page Custom ChoixParamsInstall ChoixParamsInstallLeave " : Paramètres d'installation de DOMEVIH"
Page Custom PgInstall PgInstallLeave " : Paramètres d'installation de PostgreSQL"
Page Custom SavePassword SavePasswordLeave " : Connexion au serveur de base de données"
Page Custom ChoixInstallBase ChoixInstallBaseLeave " : Choix installation base"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup
!insertmacro MUI_PAGE_INSTFILES
Page Custom ChoixRep ChoixRepLeave " : Sélection répertoires"
!insertmacro MUI_PAGE_FINISH
I wanted the standard page "!insertmacro MUI_PAGE_DIRECTORY" to be skipped" in certain conditions coming from my custom pages...
How can I do ?
Anders
30th April 2009 15:34 UTC
call abort in the pre callback function to skip a page, read the MUI docs to find the name of the define to use
sylvinhio
30th April 2009 15:38 UTC
Whet do you mean using the terms "the define to use" ?
Thanks a lot
sylvinhio
30th April 2009 16:52 UTC
In fact, I want the page !insertmacro MUI_PAGE_DIRECTORY not being displayed at each time...
And I didn't find anything on the doc...
Anders
30th April 2009 17:06 UTC
If you tried to RTFM, you would find MUI_PAGE_CUSTOMFUNCTION_PRE
so:
function maybeAbort
;maybe call abort here
functionEnd
...
page custom foo bar
!define MUI_PAGE_CUSTOMFUNCTION_PRE maybeAbort
!insertmacro MUI_PAGE_DIRECTORY
sylvinhio
30th April 2009 18:03 UTC
I had found that example but didn't succes in trying it...
I tried like that with your example (I need to skip these three files when the consition is not ok):
!define MUI_PAGE_CUSTOMFUNCTION_PRE maybeAbort
!insertmacro MUI_PAGE_DIRECTORY
!define MUI_PAGE_CUSTOMFUNCTION_PRE maybeAbort
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup
!define MUI_PAGE_CUSTOMFUNCTION_PRE maybeAbort
!insertmacro MUI_PAGE_INSTFILES
Page Custom MyPageFunction ""
function maybeAbort
${If} $Condition == "false"
Abort
${EndIf}
functionEnd
The problem is that when the condition is not OK, my three pages are hidden, but I've got an empty page displayed before my last page (MyPageFunction).
If I'm not using the INST_FILES page, that empty page is not displayed and I've got directly my last page :
!define MUI_PAGE_CUSTOMFUNCTION_PRE maybeAbort
!insertmacro MUI_PAGE_DIRECTORY
!define MUI_PAGE_CUSTOMFUNCTION_PRE maybeAbort
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup
Page Custom MyPageFunction ""
Maybe the INST_FILES page has a different behaviour than others... ?
Thanks a lot for your help !!!
Afrow UK
30th April 2009 19:16 UTC
What do you mean by an empty page exactly? Are you not creating a page with nsDialogs or InstallOptions in it yet?
Stu
demiller9
30th April 2009 23:28 UTC
sylvinhio, I think the INSTFILES page might act differently. I think you probably would not want to skip it because that page is the page that executes the Sections in your script and normally does the installation.
Don
sylvinhio
4th May 2009 09:12 UTC
Hi,
Thanks for your answers.
Effectively, I want to skip the INSTFILES page too, because in one case in my setup, I needn't to copy files, and treatments are done in previous pages (upadte config files, install framework, ...)
So I don't want the INSTFILES page to be displayed.
And my problem, as I told you previously, is that when trying to skip the INSTFILES, I've got an empty page displayed, with only PREV, NEXT and CANCEL buttons displayed.
Thanks for helping me
sylvinhio
20th May 2009 09:43 UTC
Hello,
Is there any soluce to skip that empty page ?
Thanks
justme123
21st December 2009 16:52 UTC
i'm also seeing this behaviour. Anyone got an Idea how to solve it?
I tried to use Abort in MUI_PAGE_CUSTOMFUNCTION_SHOW instead of PRE but it didn't work (kinda expected).
Actually i don't want to skip the page completely but change the (sub)title labels if a condition is met(a variable tells if the installer is in 'install' or 'upgrade' mode). So i thought using 2 Versions of the page but showing only one would do the trick (this works for the finish page):
!define MUI_PAGE_CUSTOMFUNCTION_PRE skipIfUpgrade
!define MUI_INSTFILESPAGE_FINISHHEADER_TEXT "Installation done"
!insertmacro MUI_PAGE_INSTFILES
!define MUI_PAGE_CUSTOMFUNCTION_PRE showIfUpgrade
!define MUI_INSTFILESPAGE_FINISHHEADER_TEXT "Upgrade done"
!insertmacro MUI_PAGE_INSTFILES
but for instfiles it creates an additional empty page that requires a 'next' cklick to close it.
using conditional defines in the pre funtion of a single instfiles page didn't work for me either :/