Page 1 of 1 1
Topic Options
#139177 - 2005-05-05 12:53 AM Quick UDF Question: Does one exist that checks for installed programs?
thepip3r Offline
Hey THIS is FUN
*****

Registered: 2005-03-02
Posts: 350
I ran a search on the UDF section and couldn't find one but wasn't sure if anyone knew of one that I may have missed? Is there a UDF out there that checks to see if a program is installed or not???
Top
#139178 - 2005-05-05 01:04 AM Re: Quick UDF Question: Does one exist that checks for installed programs?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Several UDFs check for specific apps but there is no universal checker.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#139179 - 2005-05-05 01:07 AM Re: Quick UDF Question: Does one exist that checks for installed programs?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Since you can form a WMI query to check for installed software, I guess I was wrong. The WMIQuery() UDF would match your requirement.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#139180 - 2005-05-05 01:09 AM Re: Quick UDF Question: Does one exist that checks for installed programs?
Jose Offline
Seasoned Scripter
*****

Registered: 2001-04-04
Posts: 693
Loc: Buenos Aires - Argentina
This could do.
Code:
  
$ProgramArray=GetUninstallInfo()

For Each $Program In $ProgramArray
If $Program="your program"
? "found it!"
EndIf
Next

Sleep 4

Function GetUninstallInfo()
Dim $Index, $Key, $RC, $Value, $RootKey
Dim $progs[0]
$Index = 0

$RootKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"

$Key = EnumKey($RootKey, $Index)
While @Error = 0
ReDim PRESERVE $progs[$Index]
$RC = EnumValue($RootKey + $Key, 1)
If @Error = 0
$Value = ReadValue($RootKey + $Key, "DisplayName")
If $Value = ""
$Value = ReadValue($RootKey + $Key, "QuietDisplayName")
If $Value = ""
$Value = $Key
EndIf
EndIf
Else
$Value = $Key
EndIf
;? $Value
$progs[$Index] = $Value
$Index = $Index + 1
$Key = EnumKey($RootKey, $Index)
Loop
$GetUninstallInfo = $progs
EndFunction



If you dont have the exact description of the program you might want to use InStr( ) to check the presence of your soft when you do the For Each..
_________________________
Life is fine.

Top
#139181 - 2005-05-05 01:10 AM Re: Quick UDF Question: Does one exist that checks for installed programs?
thepip3r Offline
Hey THIS is FUN
*****

Registered: 2005-03-02
Posts: 350
Les, since I know you're knowledgeable on KiX and the Windows Registry, if I wanted to write a UDF that would check for the existance of an installed program, what keys would be the most accurate to check and what should be the criteria for the search? Is there a display name key or something?
Top
#139182 - 2005-05-05 01:12 AM Re: Quick UDF Question: Does one exist that checks for installed programs?
thepip3r Offline
Hey THIS is FUN
*****

Registered: 2005-03-02
Posts: 350
sorry all, those posts happened while i was writing my last one. Thanx for the info and examples guys!
Top
#139183 - 2005-05-05 01:15 AM Re: Quick UDF Question: Does one exist that checks for installed programs?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Not all apps install the same way so there is not one universal way to check for all apps. The Add/Remove check that Jose has is one possible way, WMI another and following the trail of clues starting at "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths", yet another. Some require you follow a more obscure trail starting at HKCR.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#139184 - 2005-05-05 02:24 AM Re: Quick UDF Question: Does one exist that checks for installed programs?
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Quote:

checks to see if a program is installed or not




Well since you're only wanting to determine if 1 application is installed why not just say what application here and maybe we already have code for it, or can whip some up real quick for you.

Please let us know the name of the application.

Top
#139185 - 2005-05-05 04:58 PM Re: Quick UDF Question: Does one exist that checks for installed programs?
thepip3r Offline
Hey THIS is FUN
*****

Registered: 2005-03-02
Posts: 350
I appreciate the offer NTDOC but I just wanted to make an addition to my MySQL install script so that I could ensure the script wasn't kicking off the MSI every time a user logged in. Jose's example of GetUninstallInfo() works great. When the MySQL MSI is installed it creates an uninstall key called MyODBC so it was an easy one to check for. Thanx again though guys, the information is always helpful. =D
Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 84 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.059 seconds in which 0.023 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org