Archive: support for selecting section in a script.


support for selecting section in a script.
has anyone thought about this or looked into haveing the ability to Select/Deselect Sections in the Script. for situaltions like when your app has been previously installed and you check to see which was selected on prior install and then have them selected when the Component page appears. i will give an example to hopefully make things clearer in what i mean. I am creating an installer that installs a bunch of different video/audio codecs and directshow filters. So there is alot of selections and for the uninstall i write which section is installed into the registry so when i go to uninstall it will only uninstall those that the installer itself installed. But if a user downloads an updated installer with newer codecs and directshow filters i would like to make some method that i can check the registry to see which was install and then have those components as the ones selected when the page comes up.. kinda like


Function .onInit
ReadRegDWORD $0 HKLM "Software\MyApp" "somesection"
StrCmp $0 1 "" NotInstalled
SetSection on section#
Goto done
NotInstalled:
SetSection off section#
done:
FunctionEnd

where SetSection [on|off] [section #] depending if you wanted it selected or not and then the section number.
would this be very hard to implement? it could be done before the component page is selected or if possible when ppl click on sections this could be used to select/deselect other sections that depend on it.

I agree I think this is needed. I also think the ability to hide or show a section at runtime is needed as well. Because I don't want the user to see the option if its not needed or could cause a conflict.


Well after posting this message i started poking around in the NSIS source code to see what goes on. and i implemented a working version of the SetSection but the limitations of it is that it can only be called before the actual component page is displayed and haven't figured the flag to makeing a selection not be selected when the box is created.. I think it could be rewritten to make it a little better.

And as i playing around with this i was thinking about functionality.. I think the only reasonable way to allow selection/deselection while the Component page is showing is to have something like a call back functioned called each time a selection is clicked i don't know if it would be possbile to have


Function .onListSel
Pop $1
StrCmp $1 5 "" Done
SetSection on $1
Done
FunctionEnd

and then have a variable that is filled with the section # that is clicked to do compares.. or maybe the number is placed somewhere else like pushed onto the stack so that you can pop it off into a variable. anyone have any better ideas how to manage this?