Archive: NSIS message box Q2


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.


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


Read the Manual...
You'll find usages to the MessageBox...
see also the goto statments: +0, +1, ....


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.


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

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.


I should have just said to Vytautas.
"....or how to use them in a message box?"
I think I need to know.


## $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

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"


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 :)


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

maby I shoud just stick with the last reply and edit it to my liking
:( :mad: :( :mad: :( :mad: :( :mad: :( :mad:


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


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?


Correct :)

-Stu


Thanks a heap for the help. Shouldn't need anymore.