Jump to content
Sign in to follow this  

Check registry for installed software

Recommended Posts



need to check if office is installed before script go on.

Made this, and works for other software :

$f_go = 0
; check if ghostscript is installed
    For $i= 1 to 1000
        $var = RegEnumKey("HKEY_LOCAL_MACHINE\SOFTWARE", $i)
        If @error <> 0 then ExitLoop
        $result = StringInStr($var, "Ghostscript")
        if $result > 0 Then
;~      MsgBox(0, "Ghostscript Found !", "Ghostscript is installed on your system")
            ToolTip("Find Ghostscript on your system, go on...", 0, 0)
            ToolTip("", 0, 0)
            $f_go = 1

Now i see that office, with its different versions, has different entries in registry.

There is a sure way to understand if office is installed for sure ?

thank you for help,


Share this post

Link to post
Share on other sites

_SoftwareList() return a two dimensional array with all installed software name and version.

_SoftwareList('Microsoft Office Professional Edition 2003') return a two dimensional array with the software name and version if Office 2003 is installed otherwise return NULL.

#include <Array.au3>

$oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")

$List = _SoftwareList()

$List = _SoftwareList('Microsoft Office Professional Edition 200')

Func _SoftwareList($sSoftwareName = '')
    Dim $aSoftwareList[1][2]
    $objInstaller = ObjCreate('WindowsInstaller.Installer')

    $Products = $objInstaller.Products
    For $Product In $Products
        If $sSoftwareName <> '' And $sSoftwareName <> $objInstaller.ProductInfo($Product, 'ProductName') Then ContinueLoop
        ReDim $aSoftwareList[UBound($aSoftwareList) + 1][2]
        $aSoftwareList[UBound($aSoftwareList) - 1][0] = $objInstaller.ProductInfo($Product, 'ProductName')
        $aSoftwareList[UBound($aSoftwareList) - 1][1] = $objInstaller.ProductInfo($Product, 'VersionString')
    $aSoftwareList[0][0] = UBound($aSoftwareList) - 1
    If $aSoftwareList[0][0] = 0 Then $aSoftwareList = ''
    Return ($aSoftwareList)
EndFunc  ;==>_SoftwareList

Func MyErrFunc()
    $HexNumber = Hex($oMyError.number, 8)
    ConsoleWrite("We intercepted a COM Error !" & @CRLF & _
            "Number is: " & $HexNumber & @CRLF & _
            "Windescription is: " & $oMyError.windescription)

    SetError(1); something to check for when this function returns
EndFunc  ;==>MyErrFunc

AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line

Share this post

Link to post
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
Sign in to follow this