myspacee Posted January 22, 2009 Posted January 22, 2009 Hello, 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) Sleep(2000) ToolTip("", 0, 0) $f_go = 1 ExitLoop EndIf Next 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, m.
Danny35d Posted January 22, 2009 Posted January 22, 2009 _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() _ArrayDisplay($List) $List = _SoftwareList('Microsoft Office Professional Edition 200') _ArrayDisplay($List) 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') Next $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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now