- NSIS Discussion
- How to check if a soft is installed?
Archive: How to check if a soft is installed?
oldfox
7th April 2005 23:54 UTC
How to check if a soft is installed?
Hi all, I just discovered that wonderfull NSIS!!
Powerful, but complicated :)
So, I am trying to look if a software is installed, and if it is, to read its path in the registery.
I know I can find this in the registery
HKEY_LOCAL_MACHINE\SOFTWARE\ActiveState\ActiveTcl\8.4.8.0 --> (default) REG_SZ C:\thepath
But I didn't manage to find it and then read it ...
Im pretty unfamiliar with registery function of NSIS and even with the registery by itself...
This
http://nsis.sourceforge.net/archive/...ances=0,11,770
seems interesting (if I succeed to install it :D ), but I don't know exactly what to put in args to find my key and then read it.
Thx for your help!!
oldfox
8th April 2005 00:32 UTC
After some tests,
IfKeyExists "HKLM" "SOFTWARE" "ActiveState"
Seems to be working, but I still can't test deeper to check the subdirectories.
(IfKeyExists "HKLM" "SOFTWARE" "ActiveState\ActiveTcl\8.4.8.0") doesn't works.
And I still can't access that RG_SZ with the path :'(
Comperio
8th April 2005 01:46 UTC
I've not tested it, but just looking at the macro code at http://nsis.sourceforge.net/archive/...nces=0,11,770, it appears that you should be calling the macro this way:
!insertmacro IfKeyExists "HKLM" "SOFTWARE\ActiveState\ActiveTcl" "8.4.8.0"
pop $R0
$R0 should then contain 1 if the reg key exists.
Yathosho
8th April 2005 01:46 UTC
IfKeyExists?? never heard of that one and i can't find it in the docs. anyway, that question was asked so often (and is surely listed in the faq) that you should find the when answer searching this forum.
oldfox
8th April 2005 09:45 UTC
!insertmacro IfKeyExists "HKLM" "SOFTWARE\ActiveState\ActiveTcl" "8.4.8.0"
pop $R0
Doesn't work : it don't find the key any more :(
How can I do ?
I have another little problem : how to code a if {} else {} section?
I don't find explanations in the documentation and my try isn't working :
StrCmp $R0 "1" Iftest NIftest
NIftest:
MessageBox MB_OK "Didn't find it $R0"
Iftest:
MessageBox MB_OK '"Finded!! Pas besoin installer $R0"'
When it don't find it, it also execute the "Finded" code :'(
Comperio
8th April 2005 21:01 UTC
Do you have permissions to that part of the registry?
You've got me curious now, too, so when I get some free time later tonight, I can try to setup a quick test.
The If-then code should be included in the LogicLib header. (There's an example of its usage in the examples folder included with NSIS setup.)
Comperio
9th April 2005 01:42 UTC
OK, it seems to work for me.
Since I didn't have the software, I manually edited my registry to create the proper keys. Then, I built a very simply install using the exact same code from Vytautas at the archive site listed above. It worked exactly like I expected it to.
I zipped the REG file I used along with the same script (attached). Feel free to look it over.
Comperio
9th April 2005 01:43 UTC
Oops! Forgot the attachment. I'll try that again...