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!
ReadRegStr and user variables
4 posts
maybe you need to quote variables.
Should Work
The following worked for me using NSIS 2.0b under Windows 98 SE.
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?
The following worked for me using NSIS 2.0b under Windows 98 SE.
Output in the listbox is: audio/mid
;--------------------------
# [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 ; ================================
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?
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 🙂