Archive: Help With INI Istall Options


Help With INI Istall Options
I am trying to create an installer that gets the components to install from an INI file extracted .oninit but I am unsure as to how to go about this. Depending on the INI file setting will depend on which components get selected to install, follows an example of what i am trying to do:-

ReadINIStr $INI_VALUE "c:\Install.ini" "CONFIG" "Email"
StrCmp $INI_VALUE "1" "" +8 ;NO_EMAIL
SectionEnd

SubSection /e "Extra Options" SecExtra

Section "E-mail Option" SecEmail
StrCmp $INI_VALUE "1" +6 "";NO_EMAIL

NO_EMAIL:
SectionEnd
Section /o "E-mail Option" SecEmail2

Main:
SectionIn 1 RO

So if the StrCmp is true it should select the component to install, if the StrCmp is False then is should deselect the component not to install.

I hope this makes sense to someone and I am trying to do something that is possible within NSIS.

Thanks in advance.


You need to unselect the sections before the components page is shown. Probably the best place to do this is .onInit. To unselect a section you don't jump over its definition (you can only jump over instructions, see docs about relative jumps), instead you set the section's flags and remove SF_SELECTED. There are macros that make this easier in Include\Sections.nsh. To include those in your script simply use !include "Sections.nsh".


Thanks I will give it a try


Right I cannot work out what i need to include in my installer to do this yet (apart from !include Sections.nsh) thanks for pointing me in the right direction, if you can give any more help it would be appreciated (if you have a moment) as I am new to this I will get there eventually i think but may take some time.