Archive: How to display a custom page based on a setup type


How to display a custom page based on a setup type
Hi,

I have created a small installer with a custom page, asking for a specific path. Now I want to be able to show this dialog only, if the customer/user has selected a specific setup type. So for instance, only when he chooses Custom as the setup type.

Now I have read a number of the forums, and I looked into the documentation, but I need so help or guidance on how this could be done.

Any help or just ideas would be very much appreciated.

Thanks in advance.

Vincent


See NSIS documentation 4.9.13.10 GetCurInstType
Once you manage this, on custom page's create function before the InstallOptions call, check the var and if for instance is anything else than 32 which is the custom install, add abort to skip the page,


Thanks. I will have a good read into that chapter.


Hi,

I want to get the current install type with GetCurInstType
but i can't get the custom install type.

InstType Full

GetCurInstType get 0 for "Full" but also 0 for custom ( i think the documentation says custom is ${NSIS_MAX_INST_TYPES} ?)
I'm really confused about.

Thx
Frank


${NSIS_MAX_INST_TYPES} == 32


InstType "Full"

Function .onSelChange
;MessageBox MB_OK "Hallo?"
GetCurInstType $R1
${If} $R1 == ${NSIS_MAX_INST_TYPES}
MessageBox MB_OK "Custom"
${EndIf}
FunctionEnd

The messagebox appears never.


Well custom or not (32) is depended on selected/deselected components, e.g. if you select custom from dropdown without changing the components selection then the current install type is still full.
Here is a related example:

OutFile "Test.exe"
InstallDir "$PROGRAMFILES\boo"

InstType Typical
InstType Full

!include "mui.nsh"

!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
!insertmacro MUI_PAGE_COMPONENTS
Page Custom custcreate custleave
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH

!insertmacro MUI_LANGUAGE "English"

Section "common" sec1
SectionIn 1 2
SectionEnd

Section "data" sec2
SectionIn 1 2
SectionEnd

Section /o "examples" sec3
SectionIn 2
SectionEnd

Function custcreate
GetCurInstType $0
StrCmp $0 32 next
Abort
next:
!insertmacro MUI_HEADER_TEXT "Warning! Custom Installation" \
"You may see this page whenever your selection is custom installation!"
push $0
InstallOptions::Dialog "$PLUGINSDIR\custom.ini"
pop $0
pop $0
FunctionEnd

Function custleave
MessageBox MB_OK "This is a custom installation"
FunctionEnd

Function .onInit
InitPluginsDir
GetTempFileName $0
Rename $0 "$PLUGINSDIR\custom.ini"

WriteINIStr "$PLUGINSDIR\custom.ini" "settings" "numfields" "1"
WriteINIStr "$PLUGINSDIR\custom.ini" "field 1" "type" "groupbox"
WriteINIStr "$PLUGINSDIR\custom.ini" "field 1" "text" "I'm a GroupBox, or not..."
WriteINIStr "$PLUGINSDIR\custom.ini" "field 1" "left" "10"
WriteINIStr "$PLUGINSDIR\custom.ini" "field 1" "right" "-10"
WriteINIStr "$PLUGINSDIR\custom.ini" "field 1" "top" "10"
WriteINIStr "$PLUGINSDIR\custom.ini" "field 1" "bottom" "-10"
FunctionEnd