- NSIS Discussion
- Logging Install Type
Archive: Logging Install Type
ViperInc
2nd September 2002 08:43 UTC
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
kichik
2nd September 2002 10:11 UTC
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.
ViperInc
2nd September 2002 10:37 UTC
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?
kichik
2nd September 2002 10:41 UTC
Each type is numbered, starting at 1.
Currently there is no easy way to get it, you will have to remember it :)
ViperInc
3rd September 2002 07:13 UTC
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???
kichik
3rd September 2002 11:27 UTC
Yes, SectionGetFlags for each section you want to save.
ViperInc
4th September 2002 07:26 UTC
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?
kichik
4th September 2002 08:09 UTC
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.
ViperInc
4th September 2002 08:16 UTC
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???
kichik
4th September 2002 08:35 UTC
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.
ViperInc
4th September 2002 08:42 UTC
yeah, that was my next step...
well, thanks for your help...
much appreciated!
ViperInc
4th September 2002 08:56 UTC
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
kichik
4th September 2002 09:04 UTC
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 ;)
ViperInc
4th September 2002 09:09 UTC
ok, never mind, i hav found a solution..
agian thanks!
kichik
4th September 2002 09:30 UTC
Care to share?
ViperInc
5th September 2002 07:13 UTC
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...
Dizzy007
31st October 2002 15:28 UTC
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
kichik
31st October 2002 15:33 UTC
In the latest CVS version invisibile sections can also use SectionIn, so you can use that too.
virtlink
1st November 2002 13:42 UTC
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.