albator2000
26th March 2007 18:14 UTC
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 !
Red Wine
26th March 2007 18:26 UTC
This is a compiler definition ${InstallPath}
You need to use a variable instead.
albator2000
26th March 2007 18:44 UTC
so i need to use the same name without {} ? (i'm beginner so excuse me if my questions are a bit dumb ^^)
Red Wine
26th March 2007 18:55 UTC
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 ..............
albator2000
27th March 2007 08:09 UTC
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)
Afrow UK
27th March 2007 08:44 UTC
$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
albator2000
27th March 2007 08:58 UTC
ok thanks ! i'll test this syntax as soon as i can :)
albator2000
27th March 2007 18:47 UTC
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 :(
Red Wine
27th March 2007 18:55 UTC
!define MY_PATH "Interface\AddOns"
.........
.........
.........
StrCpy $INSTDIR "$R0${MY_PATH}"
albator2000
27th March 2007 19:05 UTC
ah yes ! :D
thanks a lot for your help !