Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   Problem with reading registry key (http://forums.winamp.com/showthread.php?t=276897)

only_johhny 4th September 2007 09:09

Problem with reading registry key
 
I've been trying for a couple of hours to read a specific registry key, but I'm still unsuccessful. So I would really appreciate any help.

I would like to find the path that is listed in the registry key "HKCU\Software\Microsoft\Office\$2\Word\Options" under the name "STARTUP-PATH" (which is a REG_EXPAND_SZ entry). This key is only created if a user selects a different startup directory in Word, so I both need to know whether the key exists and if so, what its value is.

The code I've written thus far doesn't work. The key "HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Word\Options" with a value for "STARTUP-PATH" does exist in the registry, but the ReadRegStr-statement doesn't find it. The following code aborts the installation without showing anything, so $3 must be empty.

;Check for custom startup-path
ClearErrors
ReadRegStr $3 HKCU "Software\Microsoft\Office\$2\Word\Options\STARTUP-PATH" ""
${If} ${Errors}
Abort "$3" ; This line is added for debugging
SetOutPath $INSTDIR ;default startup-path
${Else}
SetOutPath "$3" ;manually changed startup-path
${EndIf}

pozbremser 4th September 2007 10:35

is "STARTUP-PATH" a KeyName?
then try
ReadRegStr $3 HKCU "Software\Microsoft\Office\$2\Word\Options\" "STARTUP-PATH"

user manual:
4.9.2.12 ReadRegStr
user_var(output) root_key sub_key name

only_johhny 4th September 2007 11:51

Thanks. That wasn't clear to me before. Now it works.


All times are GMT. The time now is 04:34.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.