jnjosh1979
21st January 2004 16:53 UTC
Need SetCurInstType Instruction Help
Hi.
I am having a problem with my SetCurInstType Instruction. It seems to be acting wierd. I am using NSIS2rc2 with the following code. I am trying to use 2 InstTypes and based on a variable which i set, install the correct section.
Heres the code:
;<----at beginning of script----->
InstType "Software Version A"
InstType "Software Version B"
;<----section area of script------->
Section "Program Files A"
SectionIn 1
;<--blah code blah-->
SectionEnd
Section "Program Files B"
SectionIn 2
;<--blah code blah-->
SectionEnd
;<----in the .onInit function------->
;// installing to software 'A'
StrCmp ${SOFTVER} "A" 0 LookAgain
SetCurInstType 1
goto CleanExit
LookAgain:
;// installing to software 'B'
StrCmp ${SOFTVER} "B" 0 Error1
SetCurInstType 2
goto CleanExit
Error1:
MessageBox MB_OK "Hey, what are you doing! Go Home..."
CleanExit:
;<----------->
I have found an entry in the forum saying that SetCurInstType is a zero-based instruction unlike SectionIn, but when I use 0 and 1 rather than 1 and 2, it does the same thing.
Please Help and Thanks in advance,
Josh
Joost Verburg
21st January 2004 17:01 UTC
Do you have a components page?
SetCurInstType only works with a components page, otherwise just put the checks in a section.
stnchris
18th February 2004 19:43 UTC
somewhat releated...
If the installer has a components page, but is run in silent mode, the sections seem to ignore the value set by SetCurInstType. That is, GetCurInstType sees that the values have been set, but the Sections that are run are the ones for the zero-th install type.
See attached .nsi that demonstrates the problem. In .onInit, it pops up a message box asking which install type to use. If you say 'no', it should switch to the second install type.
In nonsilent mode, this works. In silent mode, the section for the first install type is run, even though GetCurInstType reports that the second install type has been set.
Joost Verburg
18th February 2004 22:38 UTC
This behavior is documented and is a limitation of the current implementation of this instruction.
A better implementation is already on the to-do list.
OriginalSinner
21st January 2005 21:26 UTC
SetCurInstType in components page only
Originally posted by Joost Verburg
A better implementation is already on the to-do list.
Has this made it to the top of the todo list yet :)
It would be useful to be able to Abort the Components page if the install type had already been set in the reg for example.
I know it could be scripted but this means adding something to each section and when you have 40 sub/sections it makes the script a bit ugly.
Just wondered if it was going to make it into a release anytime soon.
Cheers,
Phil
kichik
21st January 2005 21:28 UTC
It has already been removed from the TODO list. SetCurInstType works without the components page on the latest CVS version.