Archive: Selection section through the installation type


Selection section through the installation type
Hello,

I ask your help because after several tries, I am completely lost.

In my script, I have 2 type of facility that is "XP" and "VISTA".
I also have several section.

Below the code:

! ifndef NOINSTTYPES
InstType "XP"
InstType "VISTA"
! endif

SectionGroup "Internet Explorer 8" SECGRP0003
Section / o XP SEC0015
SetOutPath $ INSTDIR \ ie8XP
SetOverwrite on
File / r "......."
SetOutPath $ INSTDIR
File "......."
WriteRegStr HKLM "$ (regKey) \ Components" XP 1
SectionEnd

Section / o VISTA SEC0016
SetOutPath $ INSTDIR \ ie8VISTA
SetOverwrite on
File / r "....."
SetOutPath $ INSTDIR
File "....."
WriteRegStr HKLM "$ (regKey) \ Components" VISTA 1
SectionEnd
SectionGroupEnd

# Installer functions
Function .onInit
# Installation choices
#Windows XP
!insertmacro SetSectionInInstType "${SEC0000}" "${INSTTYPE_1}"
!insertmacro SetSectionInInstType "${SEC0001}" "${INSTTYPE_1}"
!insertmacro SetSectionInInstType "${SEC0002}" "${INSTTYPE_1}"
!insertmacro SetSectionInInstType "${SEC0004}" "${INSTTYPE_1}"
!insertmacro ClearSectionInInstType "${SEC0003}" "${INSTTYPE_1}"
!insertmacro ClearSectionInInstType "${SEC0016}" "${INSTTYPE_1}"

#Windows VISTA
!insertmacro SetSectionInInstType "${SEC0000}" "${INSTTYPE_2}"
!insertmacro SetSectionInInstType "${SEC0003}" "${INSTTYPE_2}"
!insertmacro SetSectionInInstType "${SEC0004}" "${INSTTYPE_2}"
!insertmacro ClearSectionInInstType "${SEC0001}" "${INSTTYPE_2}"
!insertmacro ClearSectionInInstType "${SEC0002}" "${INSTTYPE_2}"
!insertmacro ClearSectionInInstType "${SEC0006}" "${INSTTYPE_2}"
!insertmacro ClearSectionInInstType "${SEC0008}" "${INSTTYPE_2}"
!insertmacro ClearSectionInInstType "${SEC0013}" "${INSTTYPE_2}"
!insertmacro ClearSectionInInstType "${SEC0014}" "${INSTTYPE_2}"
!insertmacro ClearSectionInInstType "${SEC0015}" "${INSTTYPE_2}"
InitPluginsDir
FunctionEnd


I wish that when I select the XP installation type:
- The "SEC0015" does not appear in the type of installation "vista" (gray)
- Does not check the default installation type of "XP". (leaves the possibility to check or not)

Thank you in advance for your help.

Goingoin


Hello,
to select or unselect sections depending on insttypes use the SectionIn command.
to grey out a section use the SetSectionFlag macro (see also this post http://forums.winamp.com/showthread....hreadid=308791 [308791])
Regards
Stefano


Hello,

Thank you for your answer.
In fact, I want when I select the installation type "XP" manually, I can check or uncheck the SEC0015 against by I do not want to see SEC0016 as it is for the installation type "VISTA" (and therefore that section SEC0016 is dimmed or even better yet does not appear)

I created this macro, but it does not work :

!macro SSISelect SECTION_NAME WANTED_INSTTYPE
Push $0
Push $1
IntOp $0 ${SF_SELECTED} | ${SF_RO}
SectionGetInstTypes $1 $0
IntOp $0 $0 | ${WANTED_INSTTYPE}
SectionSetInstTypes $1 $0
${if} ${WANTED_INSTTYPE} = "VISTA"
SectionSetFlags ${SECTION_NAME} $0
${EndIf}
Pop $1
Pop $0
!macroend


Sorry, I'm french and my English is pathetic.

Thank you for your reply

Goingoin


An idea Plz ?


Hello,
I tried what you told me, for it is against any dimmed.

I would like ca that is dimmed during installation 2

An idea?

Goingoin


Can't quite understand what you are after but with InstType you must use SectionIn within a Section to put that section into the install type.

http://nsis.sourceforge.net/Docs/Chapter4.html#4.6.1.4

Stu


Hello,

Attached photos of the installation.
I want to check or uncheck when installing "XP" section "Internet Explorer 8" "XP" and "VISTA" is grayed out or does not appear.

And vice versa for VISTA.

http://ggoingoin.free.fr/Images/Segala/XP.JPG

http://ggoingoin.free.fr/Images/Segala/Vista.JPG


Ah right that is making sense now :) Have a look at Examples\one-section.nsi.

Stu


Hello,

It's good I solved my problem

So I rewrote it. OnInit which is like this now:

${IfNot} ${IsWinXP}
!insertmacro SelectSection ${SEC0000}
!insertmacro SelectSection ${SEC0003}
!insertmacro SelectSection ${SEC0004}
!insertmacro SetSectionFlag ${SEC0006} ${SF_RO}
!insertmacro UnselectSection ${SEC0006}
SectionSetText "${SEC0006}" ""
!insertmacro SetSectionFlag ${SEC0008} ${SF_RO}
!insertmacro UnselectSection ${SEC0008}
SectionSetText "${SEC0008}" ""
!insertmacro SetSectionFlag ${SEC0013} ${SF_RO}
!insertmacro UnselectSection ${SEC0013}
SectionSetText "${SEC0013}" ""
!insertmacro SetSectionFlag ${SEC0014} ${SF_RO}
!insertmacro UnselectSection ${SEC0014}
SectionSetText "${SEC0014}" ""
!insertmacro SetSectionFlag ${SEC0015} ${SF_RO}
!insertmacro UnselectSection ${SEC0015}
SectionSetText "${SEC0015}" ""
${Else}
!insertmacro SelectSection ${SEC0000}
!insertmacro SelectSection ${SEC0001}
!insertmacro SelectSection ${SEC0002}
!insertmacro SelectSection ${SEC0004}
!insertmacro SetSectionFlag ${SEC0016} ${SF_RO}
!insertmacro UnselectSection ${SEC0016}
SectionSetText "${SEC0016}" ""
${EndIf}


I delete most of the installation type "XP" or "vista" and I put this ( !include WinVer.nsh) in the code so that it can choose its own version of the operating system.

Thank you for your help.

Goingoin