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}