frenchbenj
3rd March 2004 20:39 UTC
Disable custom pages based on section selected
I have built a MUI installer and it does the job well, but I have one last thing to take care of before i can truly be happy with it.
Basically, i can do two installs. The FULL install installs all the files, plus has two custom pages that ask the user to modify some code variables (IP address, etc).
The PATCH install only installs the class files, so that the configuration settings are not overridden.
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_COMPONENTS
Page custom customerConfig
Page custom systemConfig
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
I have found a function to force the user to choose either PATCH or FULL, but when they choose PATCH, i'd like to not have them go through the two custom pages (because they are not relevant for a FULL install).
So my question is: based on the choices a users makes on the MUI_PAGE_COMPONENTS, can i not show customerConfig and systemConfig?
I found some stuff online about .onInit and SHOW, but I couldn't understand it. If someone has an example, i'd be really happy!
Thanks in advance!!!
Joost Verburg
3rd March 2004 21:24 UTC
Call Abort in the custom page pre-function to skip the page.
frenchbenj
3rd March 2004 21:36 UTC
You mean in the .onInit function?
Function .onInit
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "customerConfig.ini"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "systemConfig.ini"
;==============================================================
; Mutually exclusive functions
Push $0
StrCpy $R9 ${installPatchSection}
SectionGetFlags ${installPatchSection} $0
IntOp $0 $0 | ${SF_SELECTED}
SectionSetFlags ${installPatchSection} $0
SectionGetFlags ${fullInstallSection} $0
IntOp $0 $0 & ${SECTION_OFF}
SectionSetFlags ${fullInstallSection} $0
Pop $0
; END
FunctionEnd
In the Help documentation, there is an example of using Abort in the pre function, shown below:
Page license skipLicense "" stayInLicense
Page custom customPage "" ": custom page"
Page instfiles
Function skipLicense
MessageBox MB_YESNO "Do you want to skip the license page?" IDNO no
Abort
no:
FunctionEnd
BUT this requires users to actually say yes or no. I want to be able to skip them automatically based on the components the user has chosen.
deguix
3rd March 2004 22:10 UTC
Just replace MessageBox with StrCmp to compare the information you want, without showing anything to the user.
frenchbenj
3rd March 2004 22:30 UTC
But how can i assign a variable to the choice of which component the user wants to install?
deguix
4th March 2004 03:16 UTC
Complete function (not tested, but may work):
skipLicense
SectionGetFlags${InstallPatchSection} $0
StrCmp$0 ${SF_SELECTED} 0 +2
Abort
FunctionEnd
>
frenchbenj
4th March 2004 17:00 UTC
Thanks for the reply. Im still getting trouble though.
I changed my page declarations:
Page custom customerConfig skipConfig
Page custom systemConfig skipConfig
And added the function:
Function skipConfig
Push $0
SectionGetFlags ${installPatchSection} $0
StrCmp $0 ${SF_SELECTED} 0 +2
Abort
Pop $0
FunctionEnd
When i select FULL install, it still goes to the custom screens. However, when i select PATCH, it moves you to the first custom page, and then you're stuck there (clicking Next does nothing)..
Brummelchen
4th March 2004 17:25 UTC
i would do it this way - its very simple cause i dont know better ;)
Function Config ; page itself
; read out section flag
SectionGetFlags ${installPatchSection} $0
; skip complete function if not selected
StrCmp $0 ${SF_SELECTED} 0 configdone
; your stuff or page here
configdone:
FunctionEnd
HTH
frenchbenj
4th March 2004 17:32 UTC
rock star! it works!
this forum is so incredibly helpful! Thanks to all!
When i find a second, i will clean up my script and post it in the archive for other clueless people like me to use...:)