Archive: Multiple options to install one file.


Multiple options to install one file.

 Section "InstallOptionOne" SecInstallOptionOne

${SetOutPath} "$INSTDIR\MainDir"

SectionIn RO

SectionGetFlags ${SecOptionTwo} $0
IntOp $0 $0 & ${SF_SELECTED}
IntCmp $0 ${SF_SELECTED} 0 File_OptionOne File_OptionOne

${File} "SomeOtherDir\" "FileTwo.ext"
Goto OptionOne

File_OptionOne:
${File} "SomeDir\" "FileOne.ext"
Goto OptionOne

OptionOne:
SectionEnd



This works beautifully for only copying the files needed when a user selects an option. "FileOne.ext" is installed by default, but when (SecOptionTwo) is selected, it will use "FileTwo.ext" Instead. However, I have a 3rd Option that needs to install "FileThree.ext" when (SecOptionTwo) and (SecOptionThree) are selected together, without it installing "FileOne.ext" or "FileTwo.ext".

I'm sure this is an easy thing to do, but I'm new to this and it's a lot to learn in a week, my brain is overloaded and I really need to get this out first thing after the weekend. So was hoping for some friendly advice.

Many thanks in advance.

I did not test this but I think it is close to what you want. It requires LogicLib.nsh be included, which is under C:\Program files\NSIS\Includes\
http://nsis.sourceforge.net/LogicLib

Section "InstallOptionOne" SecInstallOptionOne

${SetOutPath} "$INSTDIR\MainDir"

SectionIn RO

${If} ${SectionIsSelected} ${SecOptionTwo}
${AndIf} ${SectionIsSelected} ${SecOptionThree}
; I have a 3rd Option that needs to install "FileThree.ext" when
; (SecOptionTwo) and (SecOptionThree) are selected together,
;without it installing "FileOne.ext" or "FileTwo.ext".
${File} "SomeThirdDir\" "FileThree.ext"
${ElseIf} ${SectionIsSelected} ${SecOptionTwo}
${File} "SomeOtherDir\" "FileTwo.ext"
${ElseIf} ${SectionIsSelected} ${SecOptionOne}
${File} "SomeDir\" "FileOne.ext"
${EndIf}

SectionEnd

Nice, thankyou. Works perfectly. That will make it much easier to add more options later.

So much better that I'll convert all the other options over too :)