- NSIS Discussion
- how to choose sm dir
Archive: how to choose sm dir
crish
17th December 2001 13:52 UTC
how to choose sm dir
ok
my selfmade visible required sections works now (wow)
now i want to choose the location in the startmenu after choosing installcomponents
it should be like the components page
on top a free text
bottom the existing entries in programs
in a listbox
maybe an optional extra page ?
but it seems hard to code ...
(for me)
i tried installoptions but dont know how to get the list of the startmenu dirs
is this possible ?
cu
F. Heidenreich
17th December 2001 18:54 UTC
Hi crish,
here is a little script which shows the dirctories in $SMPROGRAMS in a listbox with InstallOptions:
Name "Startmenu Install"
OutFile "startmenu.exe"
ShowInstDetails show
InstallDir $PROGRAMFILES\Startmenu
DirText "Choose directory"
ComponentText "Choose components"
AutoCloseWindow false
InstType "Typical"
Section "Required Components"
Call RunStartmenuQuery
SectionEnd
; $8 = DLL
; $7 = ini
Function .onInit
GetTempFileName $8
GetTempFileName $7
File /oname=$8 "InstallOptions.dll"
File /oname=$7 "startmenu.ini"
FunctionEnd
; cleanup on exit.
Function .onInstSuccess
Call Cleanup
FunctionEnd
Function .onInstFailed
Call Cleanup
FunctionEnd
Function .onUserAbort
Call Cleanup
FunctionEnd
Function Cleanup
Delete $8
Delete $7
FunctionEnd
Function RunStartmenuQuery
Push $7
FindFirst $R0 $R1 "$SMPROGRAMS\*"
loop:
StrCmp $R1 "" abort
FileOpen $R2 $R1 r
StrCmp $R2 "" directory loop
directory:
StrCmp $R1 "." next
StrCmp $R1 ".." next
ReadINIStr $R3 $7 "Field 1" "ListItems"
StrCpy $R3 "$R3$R1|"
WriteINIStr $7 "Field 1" "ListItems" $R3
next:
FindNext $R0 $R1
Goto loop
abort:
CallInstDLL $8 dialog
ReadINIStr $R0 $7 "Field 1" State
DetailPrint $R0
FunctionEnd
The startmenu.ini looks like this:
[Settings]
NumFields=1
Title=Startmenu Install
BackEnabled=1
CancelButtonText=Cancel
NextButtonText=Next >
BackButtonText=< Back
[Field 1]
Type=listbox
text=bla
left=0
right=350
top=0
bottom=100
ListItems=
State=
Hope it helps -
Regards,
~ Florian
crish
18th December 2001 08:39 UTC
:D
ok i'll try this
thanks
crish
18th December 2001 14:18 UTC
small prob
ok this works fine
but only one
if i try to make this a second time (other dialog)
then the installe crashes
maybe this is because of the early state of the dll ?
or is this a bug in nsis ?
justin
18th December 2001 20:06 UTC
In order to make two dialogs you need some more advanced code to drive it. If you want, post your script+.ini files here and we'll help you edit them to work.
-Justin
crish
19th December 2001 14:07 UTC
ok my nsi file :
www.ceor.de/pms_installer.nsi
F. Heidenreich
19th December 2001 17:05 UTC
Sorry crish, but I couldn't help you without the ini-files you're using ...
~ Florian
crish
20th December 2001 13:32 UTC
the inis (they where ok with the .exe version of installoptions)
startmenu.ini
RebootOptions.ini
InstallOptions.ini
this is all
F. Heidenreich
20th December 2001 14:51 UTC
After two-time-checking your scripts (you know why?) I've found the bug in your pms_installer.nsi
The call to InstallOptions.dll in Function Reboot will fail, because your RebootOptions.ini is based on InstallOptions.exe.
Change the lines
Push $TEMP\ui${VER_MAJOR}${VER_MINOR}2.ini
CallInstDLL $TEMP\InstallOptions.dll dialog
to
ExecWait '"$TEMP\ui${VER_MAJOR}${VER_MINOR}.exe" $TEMP\ui${VER_MAJOR}${VER_MINOR}2.ini'
and your installer works.
~ Florian
crish
20th December 2001 18:46 UTC
jap
will change this to the dll version
because the exe needs to much time to start ...
u ll see the new inis on the links above
accidently posted the former inis sorry
crish
22nd December 2001 11:23 UTC
YES
it works NOW
BUT i think its a fault in the doku or in the dll
State (optional)
is NOT optional with the state in my ini files it works without it crashes ....
but now i know this and im happy
jetzt kann der wihnachtsmann kommen
cu
and a merry christmas