Jump to content

Detection of program


jul
 Share

Recommended Posts

Sure, try this

; Enter Displayname as parameter
$result = _UninstallEntry('AutoIt v3.2.0.1', 1)
If Not @error Then
    MsgBox(0, '', $result)
;~  RunWait($result)
EndIf

Func _UninstallEntry($displayname, $value = 0)
    Local $key_main = 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall'
    Local $i, $key_main, $key_result, $key_sub, $version, $size = StringLen($displayname)
    Switch $value
        Case 1
            $value = 'UninstallString'
        Case 2
            $value = 'QuietUninstallString'
        Case 3
            $value = 'DisplayVersion'
        Case Else
            $value = ''
    EndSwitch
    For $i = 1 To 1000
        $key_sub = RegEnumKey($key_main, $i)
        If @error Then ExitLoop
        If StringLeft(RegRead($key_main & '\' & $key_sub, 'DisplayName'), $size) = $displayname Then
            $data = RegRead($key_main & '\' & $key_sub, $value)
            If $value = '' Then Return 'Installed'
            If $data = '' Or @error Then ContinueLoop
            Return $data
        EndIf
    Next
    SetError(1)
    Return
EndFunc

;)

Edited by MHz
Link to comment
Share on other sites

Not as thorough as the above, but...

$find = 'Thunderbird'
$i = 0
While 1
    $i += 1
    $var = RegEnumKey("HKEY_LOCAL_MACHINE\SOFTWARE", $i)
    If @error Then ExitLoop
    If StringInStr($var, $find) Then MsgBox(4096, 'Found', $find & ' is installed.')
WEnd
Edited by xcal
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...