Skip to content
⌘ NSIS Forum Archive

Problem using SetSectionInInstType

7 posts

Steven Franklin#

Problem using SetSectionInInstType

Hi,

Im trying to use SetSectionInInstType to allow the installer to select the options it "thinks" you should used depending on what it finds on the users system. This works fine except for when the page is first displayed, it is still in its default state.

Let me explain, i have a section that will be enabled/disabled in different types depending on files on the OS. By default this is unselected. If i set it to selected using SetSectionInInstType, then when the page is first displayed this option isnt selected (its still in the default). If i navigate through the options and return to the first it is now working correctly.

Any body any ideas
Steven Franklin#
thats were im using it,

Function .onInit
!insertmacro SetSectionInInstType "${name}" "${INSTTYPE_1}"
!insertmacro SetSectionInInstType "${name}" "${INSTTYPE_2}"
!insertmacro
FunctionEnd

:-(
Steven Franklin#
This is the simplest i can make the script that shows it

!include "MUI.nsh"
!include "Sections.nsh"

OutFile "C:\forum1.exe"

InstType "Type1"
InstType "Type2"

!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH

!insertmacro MUI_LANGUAGE "English"

Name "Test setup"

Section "Section1" sec1
SectionEnd

Section "Section2" sec2
SectionEnd

Function .onInit
!insertmacro SetSectionInInstType "${sec1}" "${INSTTYPE_1}"
!insertmacro SetSectionInInstType "${sec2}" "${INSTTYPE_1}"
FunctionEnd
Joost Verburg#
If you want to modify the installation type you will probably have to call SetCurInstType after the changes.