Breepee
26th February 2004 20:11 UTC
Check existence of registry key
I want to build a package that, depending on the existence of a certain registry key, copies some files to a directory (also found in the registry) or just quits. This all very silent. Getting the InstallDIr from the registry is no problem, but I don't understand the codesnippit from the NSIS-archieve http://nsis.sourceforge.net/archive/...hp?pageid=307.
Can someone create a complete basic example of a ready2compile script. I think I can manage from there.
Joost Verburg
26th February 2004 20:58 UTC
Do you really need to know whether it exits or is knowing whether it has a value enough?
In the first case, use the macro from that archive page:
!insertmacro IfKeyExists "ROOT" "KeyToCheckIn" "KeyToCheck"
Pop $R0
;$R0 contains 0 (not present) or 1 (present)
Otherwise, just compare the value form the key with "".
Devion
26th February 2004 21:56 UTC
And after that use
StrCmp $R0 1 KeyFound KeyNotFound
KeyFound:
File bla.exe
etc...
KeyNotFound:
And put that all in a Section
Comm@nder21
27th February 2004 14:09 UTC
easier:
Push $0
ClearErrors
ReadRegStr $0 ROOT "Your\Reg\Path" "YourKey"
IfErrors KeyDoesntExist KeyExists
KeyDoestnExist:
ClearErrors
# do something
Goto End
KeyExists:
# do something else
End:
Pop $0