Jump to content

Recommended Posts

Posted

Hello,

It is possible to detect if a program is installed ?

for example: thunderbird

Sorry for my bad English, I'm French.

Thank you

Posted (edited)

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

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
  • Recently Browsing   0 members

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