- NSIS Discussion
- NSIS message box Q2
Archive: NSIS message box Q2
pure-krypton
19th July 2003 11:12 UTC
NSIS message box Q2
You may have seen a message by me before on a message box but I found out what I wanted.
I want a message box that askes if you want to install into one folder(click yes) or a different folder(click no) from a regristy string. The 2 reigstry strings I want installer to use are the Winamp 2.x and the Winamp3 one.
PLZ help me.
Vytautas
19th July 2003 14:56 UTC
What exaclly is your question? Do you want to find out how to get registry values, or how to use them in a message box?
Vytautas
Joel
19th July 2003 15:56 UTC
Read the Manual...
You'll find usages to the MessageBox...
see also the goto statments: +0, +1, ....
pure-krypton
20th July 2003 02:54 UTC
I can't understand any of that stuff. If you don't know what I'm talking about goto this page: http://yathosho.deviantart.com/ then click on something that since then 7. Download it then open it. A message box should come up and it askes where to install. How does it pick out the winamp 2&3 directory no matter where it is? Can someone plz make me a message box like that.
Sunjammer
20th July 2003 04:27 UTC
OutFile mbox.exe
Section ""
MessageBox MB_YESNO "YES, continue installing in your Winamp 3.x \
directory.$\n$\n NO, install in your Winamp 2.x directory instead." \
IDYES yeslabel IDNO nolabel
yeslabel:
MessageBox MB_OK "You pressed yes"
Goto done
nolabel:
MessageBox MB_OK "You pressed no"
done:
SectionEnd
pure-krypton
20th July 2003 04:40 UTC
Sunjammer, did you go to the link???? I don't think you did. That doesn't change the install dir to the directory that you have installed your winamp's into.
pure-krypton
20th July 2003 04:42 UTC
I should have just said to Vytautas.
"....or how to use them in a message box?"
I think I need to know.
Afrow UK
20th July 2003 11:24 UTC
## $R0 = winamp2 instdir
## $R1 = winamp3 instdir
MessageBox MB_YESNO|MB_ICONQUESTION "Click Yes to install to \
$R0.$\r$\nClick No to install to $R1." IDNO dir2
StrCpy $INSTDIR $R0
Goto exit
dir2:
StrCpy $INSTDIR $R1
exit:
Is that what you want?
-Stu
pure-krypton
27th July 2003 01:37 UTC
um yes, sort of. But I want it to use these:
HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\Winamp" \
"UninstallString"
AND
HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\Winamp3" \
"UninstallString"
Vytautas
27th July 2003 05:26 UTC
Use the code from Afrow UK and add these lines before his script
ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Winamp" "UninstallString"
ReadRegStr $R1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Winamp3" "UninstallString"
This will work perfectly if both versions are installed but if one is missing the message box will not make sense so you should check to see if both versions are installed and if not then skip the message box and use the path of the installed version.
Vytautas :)
Afrow UK
27th July 2003 11:54 UTC
ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Winamp" "UninstallString"
ReadRegStr $R1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Winamp3" "UninstallString"
StrCmp $R0 "" 0 +3
StrCpy $INSTDIR $R1
Goto exit
StrCmp $R1 "" 0 +3
StrCpy $INSTDIR $R0
Goto exit
## $R0 = winamp2 instdir
## $R1 = winamp3 instdir
MessageBox MB_YESNO|MB_ICONQUESTION "Click Yes to install to \
$R0.$\r$\nClick No to install to $R1." IDNO dir2
StrCpy $INSTDIR $R0
Goto exit
dir2:
StrCpy $INSTDIR $R1
exit:
This will work.
-Stu
pure-krypton
30th July 2003 11:14 UTC
maby I shoud just stick with the last reply and edit it to my liking
:( :mad: :( :mad: :( :mad: :( :mad: :( :mad:
Afrow UK
30th July 2003 11:27 UTC
There is nothing wrong with the script.
It works fine.
Place in .onInit function.
I put this part in special:
ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Winamp" "UninstallString"
ReadRegStr $R1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Winamp3" "UninstallString"
StrCmp $R0 "" 0 +3
StrCpy $INSTDIR $R1
Goto exit
StrCmp $R1 "" 0 +3
StrCpy $INSTDIR $R0
Goto exit
It stops the message box appearing if one of the registry values is missing, because if e.g. Winamp1.x value is missing, then there is no point asking the user to optionally install to Winamp1.x dir [does not exist]
-Stu
pure-krypton
30th July 2003 11:38 UTC
does this:
WriteRegStr HKLM SOFTWARE\Pure_Krypton\Winamp3 "Install Location" $INSTDIR
create a registry string/setting (don't know the correct name to use) from the install directory that you have specified?
Afrow UK
30th July 2003 13:04 UTC
Correct :)
-Stu
pure-krypton
7th August 2003 13:38 UTC
Thanks a heap for the help. Shouldn't need anymore.