Jump to content

checking software version


Recommended Posts

anyone know what the script is to check for a software version before it executes. I'm trying to include a "if" statement, "if you will" to check the software version. if the version exist.....I want autoit to exit, but if it doesn't continue with installation. Help!

Link to comment
Share on other sites

You could look at the file date for the program executable... or whatever applicable file would be appropriate.

Edited by SpookMeister

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Link to comment
Share on other sites

gettyhd welcome to autoit

UDF _SoftwareList() give you a 2 dimensional array with the software name and version.

Array[n][0] = Software Name

Array[n][1] = Software Version

#include <Array.au3>

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

$List = _SoftwareList()
_ArrayDisplay($List)

$List = _SoftwareList('microsoft .net framework 1.1')
_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
    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

Edit: Forgot to add MyErrFunc() UDF

Edited by Danny35d
AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
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...