Skip to content
⌘ NSIS Forum Archive

Problem with conditional Installer page

3 posts

PerryRho#

Problem with conditional Installer page

I use a Modern UI installer structure with an entry for a custom page that launches one of my applications at the end of the installation process,
like
...
!insertmacro MUI_PAGE_STARTMENU Application $ICONS_GROUP
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_RUN "$INSTDIR\MySpecialApp.exe"
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES

Now I define 3 InstTypes, and Type 2 is without installing MySpecialApp.
When within the installation process I choose Type 2, I have to make sure that the "Run MySpecialApp now" page is not displayed for this InstType.
I fail repeatedly.
Mostly because "if[InstType2] - then[don't display that thing]" conditions must appear in sections or functions, but the installer page listn is not within a function, but apparently plain body text after the header.
Is it possible to switch an installer page on or off depending on the InstType value?
I didn't see any related thread in the forum. If there is any, and I was just too blind - a link will be my friend.

Thanks in advance,

John.
kichik#
You've missed the FAQ which contains an entry about skipping pages.

To figure out which installation type was selected, you can use GetCurInstType, but it'd be simpler to check if $INSTDIR\MySpecialApp.exe exists.
PerryRho#
So I tried ...

but sorry, I couldn't see any useful hint in the FAQ for this problem.
The main thing seems to be that I cannot build a function that is able to switch between the finish pages
MUI_FINISHPAGE_RUN "$INSTDIR\MySpecialApp.exe"
and
MUI_PAGE_FINISH
depending on the value of e.g. GetCurInstType. Either it isn't allowed to call macros containing that AutoCloseWindow parameter from within a function (as MUI_PAGE_FINISH is one of them), or it is impossible to use an if-then-condition outside a function. And I try to make an installer whose pages can be activated or deactivated depending on the InstallType, like
"if InstallType is [a], then call finishpage 1, else call finishpage 2"
I still can't figure out where this "else" has to be placed.
I hope anyone has a straw for me to clutch on.