Archive: reading reg problem


reading reg problem
hi there

i'm writing an addon installer for world of warcraft and i need to get the WoW install path in order to install addon in the right folder wherever user has installed WoW

so i wrote this :

Function .onInit
ReadRegStr ${InstallPath} HKLM "SOFTWARE\Blizzard Entertainment\World of Warcraft" "InstallPath"
FunctionEnd


and the i use :

InstallDir "${InstallPath}\Interface\AddOns"


but it doesn't work :(
here is my error message :

Fonction: "_WoWPath"
Usage: ReadRegStr $(var_utilisateur: destination) clé_racine sous_clé entrée
clé_racine=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD)
Erreur dans le script "stdin" a la ligne 2049 -- abandon du processus de creation


it seems that my ReadRegStr isn't right but i can't figure out where is my mistake...

i hope you guys will help me, thx !

This is a compiler definition ${InstallPath}
You need to use a variable instead.


so i need to use the same name without {} ? (i'm beginner so excuse me if my questions are a bit dumb ^^)


If you prefer to use your own variable instead of registers $0-$9 and $R0-$R9 you need to declare it first, e.g.

var InstallPath ;out of section or function otherwise /global see manual
.......
.......
Function .onInit
ReadRegStr $InstallPath ..............


ok i've done this :

Function .onInit
ReadRegStr $R0 HKLM "SOFTWARE\Blizzard Entertainment\World of Warcraft" "InstallPath"
FunctionEnd


and then :

InstallDir "$R0\Interface\AddOns"


i can compile without error but during installation $R0 seems to be blank because the default path is "/Interface/AddOns" without the install patch i've got in registry :rolleyes: (and i've checked twice, the reg key i'm reading is not blank)

$R0 is used by many NSIS functions to exchange data.
You're better off doing:


InstallDir "C:\default path\Interface\AddOns"

Function .onInit
ReadRegStr $R0 HKLM "SOFTWARE\Blizzard Entertainment\World of Warcraft" "InstallPath"
StrCmp $R0 "" +2
StrCpy $INSTDIR "$R0\Interface\AddOns"
FunctionEnd


Stu

ok thanks ! i'll test this syntax as soon as i can :)


ok it works but now here is my problem :

InstallDir "C:\Program Files\Wolrd Of Warcraft\Interface\AddOns"

Function .onInit
ReadRegStr $R0 HKLM "SOFTWARE\Blizzard Entertainment\World of Warcraft" "InstallPath"
StrCmp $R0 "" +2
StrCpy $INSTDIR "$R0\Interface\AddOns"
FunctionEnd


my install path is K:\World of Warcraft\\Interface\AddOns
i tried to use a var like ${test} to avoid the \\ issue (if i remove the extra \ it undersand $R0Interface like a var) but i can't get it working :(

!define MY_PATH "Interface\AddOns"

.........
.........
.........

StrCpy $INSTDIR "$R0${MY_PATH}"


ah yes ! :D

thanks a lot for your help !