Skip to content
⌘ NSIS Forum Archive

Conditionally remove components page

3 posts

lyz#

Conditionally remove components page

Hi there,

I want to hide components page conditionally. I've tried to following code, but it does not work:

!ifndef HIDE_COMP_PAGE
!insertmacro MUI_PAGE_COMPONENTS
!endif

...

Function .onInit
IfFileExists "foo.bar" AlreadyInstalled NotYetInstalled
AlreadyInstalled:
!define HIDE_COMP_PAGE "true"
NotYetInstalled:
FunctionEnd


I also tried to put the code in .onInit to .onGUIInit. But that did not for me either. Can anyone give me some help on this one?

Thanks
Takhir#
Components page skipping

This is how I did it for components page to be shown if dotnetfx.exe file presents in the $EXEDIR:

!define DOT_EXE dotnetfx.exe
!define MUI_PAGE_CUSTOMFUNCTION_PRE compPre
Function compPre
IfFileExists "$EXEDIR\${DOT_EXE}" showComp
Abort ; skip components page
showComp:
FunctionEnd
lyz#
Thanks Takhir!

I also figured out how to do it after I posted the question. And I did it exactly the same way as yours, and it worked like a charm! 😁

Thanks.