Archive: readRegSTr not working


readRegSTr not working
Section
ReadRegStr $W HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\test UninstallString
IfErrors 0 +2
ExecWait '$W /S'
SectionEnd

is there anything incorrect in this?


cannot compile it
Usage: ReadRegStr $(user_var: output) rootkey subkey entry
root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD|SHCTX)
Error in script "C:\save\nsis-2.12\test.nsi" on line 41 -- aborting creation process


Do you have


Var W

definition?

i dont have,,
do i need it?


yep, you do.

Var W
should be placed BEFORE you use $W the first time.

but you may also just use register variables, like $0.
they are already defined by nsis itself.


ReadRegStr $0 HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\test UninstallString
IfErrors 0 +2
ExecWait '$0 /S'
SetOutPath "$INSTDIR"
------------------------------------------------------------

is this ok?
but seems not working very well


my installer does not ExecWait '$0 /S'

the reg entry is exist


ExecWait '"$0" /S'

And your IfErrors logic is incorrect.

IfErrors [jump_if_errors] [jump_if_no_errors]

So, you are only executing the ExecWait instruction if ReadRegStr fails.
Another problem with your code (unless you have just missed it from your code snippet) is that you are not using ClearErrors before ReadRegStr. Therefore if ReadRegStr was successul and something else before caused an error then your ExecWait instruction will still not be executed.


Section
ClearErrors
ReadRegStr $0 HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\test UninstallString
IfErrors +2
ExecWait '"$0" /S'
SectionEnd

[/code]

-Stu

thanks for the help!