Archive: Problems with /COMPONENTSONLYONCUSTOM


Problems with /COMPONENTSONLYONCUSTOM
  Alright I have searched and expirimented for the last 4 hours trying to get this to work right and I can't find a way. I can get it to work 50% right but that's about it.


I am creating an installer to install modified system files. Originally I had 3 install types. One install type installed all the common system files. Another install type would just install shell32, and the 3rd would bring up a custom page allowing the user to just extract the files from the installer to a directory of their choice so they could modify them on their own. It was all working using this method but the user could still choose components using the 3rd install type.

Now, however, I've decided to just use the 3rd install type and the custom install type using /COMPONENTSONLYONCUSTOM so that the user can't choose components when using the extraction install type.


Here's a condensed version of my code. The goal is that when the "Extract Files Only" install type is chosen the components page disappears, then you hit next and you're given a page to choose the directory to extract the files to (THAT part works). But, then I want it that when you pull the menu down and choose the Custom install type, it turns of the "Extract" section (I want to keep that section hidden) and won't show the custom page. Whenever I choose the custom install type the extract section is still turned on and when I hit next it brings up the custom page dialog.

Any help would be appreciated.

!insertmacro MUI_PAGE_COMPONENTS

Page directory ExtractDir "" ""
>!insertmacro MUI_PAGE_INSTFILES

>;------------------------------------------
;Install Types
>;------------------------------------------
InstType "Extract Files Only"
InstType /COMPONENTSONLYONCUSTOM


>;------------------------------------------
;Section Extract Files
>;------------------------------------------
Section "-EXTRACT" Extract
SectionIn 1
SetOverwrite on
SetOutPath "$INSTDIR"
File /r "*.*"
Delete "$OUTDIR\*.nsi"
RMDir "$OUTDIR\misc"
SectionEnd

Function ExtractDir
ClearErrors
SectionGetFlags${Extract} $R7
IntOp $R7 $R7& ${SF_SELECTED}
IntCmp $R7 ${SF_SELECTED} +2
Abort
FunctionEnd

>;------------------------------------------
;Section Create Restore Point
>;------------------------------------------
Section "Create Restore Point" restorepoint
SetOutPath "$TEMP"
File "misc\utilities\restorepoint.vbs"
ExecShell open "$TEMP\restorepoint.vbs"
Sleep 3000
SectionEnd



>;------------------------------------------
;Section Install shell32.dll
>;------------------------------------------
Section "Shell32" SHELL32
SetRebootFlag true
SetOutPath "$SYSDIR"
!insertmacro InstallFile "shell32.dll" "$SYSDIR"
SectionEnd
>.
.
.
>etc....

The custom installation type is not a type you can use with SectionIn. It is a type which allows the user to select whatever sections he or she wants. Therefore, the hidden "-Extract" section is not unselected when the user chooses the custom type.

To avoid this, you can use GetCurInstType to check the selected installation type and unselect the first section or just add this condition to the ExtractDir function.