Archive: Logging Install Type


Logging Install Type
hi.

quick question.
i want to make a regkey or something, which will let the installer resume after a restart, and continue to install the software, depending on what seting the user specified befour
eg. InstType 1, or InstType 2, etc.

is there any easy way to do this???

ive had an attempt, but doesnt work to well...
well, not at all
hehe...

thanx


You can always log each section's state using SectionGetFlags, but if you want to log the install type (make sure there is no custom option), make a hidden section for each install type and make it write to the registry the install type.


that was the plan.

is there a number assocated with the instType or something???

the program is getting the value, 1, 2 or 3.
how do i get it?
what variable is assigned the value?


Each type is numbered, starting at 1.
Currently there is no easy way to get it, you will have to remember it :)


so basically, nsis doesnt hav a variable which stores this info.
i hav to get each section to make a line in the registry, or something like that???


Yes, SectionGetFlags for each section you want to save.


ah, of corse...

thanks for that.

so with this i can store what InstTpye the user sets.

eg.

InstType "Type 1"
InstType "Type 2"
InstType "Type 3"

Section "Standard (Required)"
SectionEnd

Section "Section2"
SectionIn 2
SectionIn 3
SectionEnd

Section "Section3"
SectionIn 1
SectionIn 2
SectionEnd

how would i log if the user selcts InstType 1, 2 or InstType 3?


If you want to log the install type (make sure there is no custom option), make a hidden section for each install type and make it write to the registry the install type.
;)

For example:
Section ""
SectionIn 1
WriteRegStr HKLM "whereever\you\want\to\save" "insttype1" "selected"
SectionEnd

The problem is that if a user uses a custom selection you won't get the wanted results.

You might want to unselect every hidden section as the above one when you the user selects a custom set of sections. To do this you will have to use a lot of GetSectionFlags to make sure no set install type was selected.

The best way IMHO, is to just save the sections that the user really have installed and not to look on the install types. That is of cousrse, unless you don't allow custom.

i hav added the /nocustom , so the usre cant allow do a custom selection.

the problem arrise though, is that after each section is called up, on then is a regestry key created.
so if for example, in section 1, a restart occers, only the section 1 entry wil be saved.
this means thatupon reboot, when the program resumes, it cant detect which instType was selected.
i guess i should hav mensioned this befour... sorry

so, basically , i need to create a key just after the user selects the instaype and selects install. but, it seems that its not possible. or am i wrong again???


It is possible, but not that simple. You will have to use the .onNextPage callback after the components are selected, and use a lot of SectionGetFlags in it to find out which InstType was selected.

A small trick that could help you would be creating those hidden sections after all and make sure every hidden section is only in one InstType. Then just use SectionGetFlags on every one of those hidden sections to find out which InstType was selected. This way you have only one "if" for every InstType.


yeah, that was my next step...
well, thanks for your help...


much appreciated!


ok, ive just started to add in the hidden stuff... but

it seems that any hidden section is automatically caleld upon, where its specifed or not, or so it seems from the nsis docu's

or is that only for un-named sections????
eg, if i do what i hav below, will it run all of then, or aonly the ones that i call???

Section "-hidden1"
sectionin 1
do stuff
make reg string
SectionEnd

Section "-hidden2"
sectionin 2
do stuff
make reg string
SectionEnd

Section "-hidden3"
sectionin 3
do stuff
make reg string
SectionEnd


Hmm... I can quite test it now because I am not at home, and I can't install NSIS here. I will answer you later unless someone answers before me ;)


ok, never mind, i hav found a solution..

agian thanks!


Care to share?


um,

i just made each section hav its own installation stuff, so i dont hav to move threw sections..
then on restarts, i just chek the reg, befour the program luchnes, then the setup continues, and bypasses all the NSIS prgram front and so forth...

quite happy with myself now...


I have had the same problem ..

This is a "workaround" :
-----
Section "Choice 1"
SectionIn 1
WriteIniStr "$TEMP\iniC.ini" "Section" "Choice" 1
SectionEnd
Section "Choice 2"
SectionIn 2
WriteIniStr "$TEMP\iniC.ini" "Section" "Choice" 2
SectionEnd
Section "Choice 3"
SectionIn 3
WriteIniStr "$TEMP\iniC.ini" "Section" "Choice" 3
SectionEnd
Section "Choice 4"
SectionIn 4
WriteIniStr "$TEMP\iniC.ini" "Section" "Choice" 4
SectionEnd
Section "Choice other"
SectionIn 5
WriteIniStr "$TEMP\iniC.ini" "Section" "Choice" 5
SectionEnd
----
So, i wrote the InstType section to my ini - available at every time ..

:D

Greets
Dizzy


In the latest CVS version invisibile sections can also use SectionIn, so you can use that too.


let the installer resume after a restart, and continue to install the software
I don't know if you know this already:o, but if you write to this registry key:
HKEY_LOCAL_MACHINE/Software/Microsoft/Windows/CurrentVersion/RunOnce
...and you make a new key or string (I can check right now) with the name of your program and the setup-path as the value, It should be started on Windows startup, but only once.