Search code examples
internet-explorerautoitcomobject

Is there a more elegant way to get the Internet Expolor version with AutoIt


Summary:

I'm looking for a more elegant way to get the Internet Explorer (IE) version on a windows computer (especially with AutoIt, because of the compiled *.exe). My current solution (follows below) do the job, but maybe there is a better way with pure AutoIt function(s) (UDFs)?

Background and goal:

I have to check for a specific IE versions and in general for versions lower then 11 (11.0.9600).

There are round 60 devices (server, laptops, etc.) which I have to check. The compiled *.exe will find the version and set a entry of that information (besides some other like hostname and so on) to a small HTML report. That remote processing and execution isn't a problem.

Code:

#include-once
#include <Array.au3>

Func _getFileProperties( $sDirectory, $sFileName, $bRemoveEmptyLines = True )
    Local $oShellApp           = ObjCreate( 'Shell.Application' )
    Local $oFolder             = $oShellApp.NameSpace( $sDirectory )
    Local $oFolderItem         = $oFolder.Parsename( $sFileName )
    Local $aPropertyList[1][2] = [[1]]

    For $i = 0 To 400 Step 1
        If $oFolder.GetDetailsOf( $oFolder.Items, $i ) Then
            ReDim $aPropertyList[$aPropertyList[0][0] + 1][2]
            $aPropertyList[$aPropertyList[0][0]][0] = $oFolder.GetDetailsOf( $oFolder.Items, $i )
            $aPropertyList[$aPropertyList[0][0]][1] = $oFolder.GetDetailsOf( $oFolderItem, $i )
            $aPropertyList[0][0] += 1
        EndIf
    Next
    _ArraySort( $aPropertyList, 0, 1, 0 )

    If $bRemoveEmptyLines Then
        For $i = $aPropertyList[0][0] - 1 To 1 Step - 1
            If $aPropertyList[$i][1] == '' Then _ArrayDelete( $aPropertyList, $i )
        Next
    EndIf

    $aPropertyList[0][0] = UBound( $aPropertyList, 1 ) - 1
    Return $aPropertyList
EndFunc

Global $aPropertyList = _getFileProperties( @SystemDir, 'ieframe.dll' )
_ArrayDisplay( $aPropertyList )

Current result:

Of course I will filter the array for my search criteria (no problem).

enter image description here

Expected result:

Is basicly the same as above (current result) but maybe in a faster way and also with AutoIt own/native function(s)? Because it's just a step of many other information which will be gathered and I try to reduce the code and to improve the readability for future editings.

Please notice that I can check for
_getFileProperties( @SystemDir, 'ieframe.dll' )or for
_getFileProperties( $sPathIe, 'iexplore.exe' ).
Both do provide the version information.

Is there an other way, more elegant and AutoIt own/native function to achieve my goal?


Solution

  • You can try to check registry details as well to verify IE version.Hope this might help you to find it other way.

    ;Internet Explorer version is
    Global $svcVersion = (RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer", "svcVersion"))
    If $svcVersion <> "" Then
        MsgBox(1, "internet Explorer Version" , "Internet Explorer version is: " & $svcVersion)
    Endif
    

    OR

    ;Internet Explorer updated version is
    Global $svcUpdateVersion = (RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer", "svcUpdateVersion"))
    If $svcUpdateVersion <> "" Then
        MsgBox(1, "internet Explorer Version" , "Internet Explorer updated version is: " & $svcUpdateVersion)
    Endif