View Full Version : ReadRegStr and user variables
IGx89
19th November 2002, 00:53
I'm trying to do the following:
ReadRegStr $2 HKLM $R4 $R7
It doesn't work, but if replace R4 and R7 with their values, then it does. I've double-checked for typos, and haven't found any. What am I doing wrong?
Thanks!
n0On3
19th November 2002, 02:28
maybe you need to quote variables.
Mottel
19th November 2002, 04:52
The following worked for me using NSIS 2.0b under Windows 98 SE.
;--------------------------
# [Global Pseudo-constants]
;--------------------------
!Define TrialName "ReadRegTest"
;------------------
# [.exe Attributes]
;------------------
Name "${TrialName}"
OutFile "${TrialName}.exe"
Caption ""
Subcaption 3 ": Trial"
ShowInstDetails show
;------
Section
;------
StrCpy $R4 ".MP3"
StrCpy $R7 "Content Type"
ReadRegStr $2 HKCR $R4 $R7
DetailPrint $2
SectionEnd ; ================================
Output in the listbox is: audio/mid
NOTE: It worked OK even without enclosing $R7 in quotes.
Are you getting a compile error or just no output?
Are you sure the ValueName you're trying to read exists in the registry?
IGx89
19th November 2002, 15:24
I finally found out my problem: there was a newline at the end of one of the vars! I thought the messagebox I used to debug automatically made a new line because of space constraints, not because it was in one of the vars! Oh well, live and learn :)
vBulletin® v3.8.6, Copyright ©2000-2013, Jelsoft Enterprises Ltd.