Sign in to follow this  
Followers 0
jazzyjeff

Reading Program Versions

7 posts in this topic

Hello,

I have a program that checks the registry for specific applications and reads the version number of that program. The version of that application is then compared to the latest release on our network, and if the version number is older, then the application is flagged for requiring an update.

So as an example, the latest version of Flash has a version number of, 11.2.202.233. If the version I had on the network is 11.2.202.234, the program should change a value in my list to say "Update required".

The problem is that the program doesn't seem to recognise multiple decimal points as a number for obvious reasons. The trouble is if I compare strings I am not going to be getting an accurate reading. For example if a user had Flash 11.2.202.233, and I haven't updated it yet on the network and am still on 11.2.202.200, it doesn't recognise that the version number is less, because the first digits are still 11.2. If it always went 11.2, 11.3, 11.4 etc it wouldn't be a problem.

So this is what I have right now:

For $w = 1 To 500
         $AppKey = RegEnumKey($uRegKey, $w)
         If StringInStr(RegRead($uRegKey & "\" & $AppKey, "DisplayName"), $iUpdate[$z][0]) Then
          $uVer = RegRead($uRegKey & "\" & $AppKey, "DisplayVersion")
          _GUICtrlListView_AddSubItem($listSoftware, $z - 1, $uVer, 2)
         EndIf
        Next
        If $uVer = "" Then
         _GUICtrlListView_AddSubItem($listSoftware, $z - 1, "Not installed", 3)
        ElseIf $uVer < $iUpdate[$z][1] Then
         _GUICtrlListView_AddSubItem($listSoftware, $z - 1, "Update required", 3)
        ElseIf $uVer > $iUpdate[$z][1] Then
         _GUICtrlListView_AddSubItem($listSoftware, $z - 1, "Installed", 3)
        Else
         _GUICtrlListView_AddSubItem($listSoftware, $z - 1, "Installed", 3)
        EndIf
        $uVer = ""

So to summarize. How can I read this, 11.2.2.2, as an Integer?

Thanks.

Jeff

Share this post


Link to post
Share on other sites



"Normalize" the string to numbers with 3 digits and then you can do a string comparison.

Global $sNewversion = ""
Global $sVersion = "11.2.2.2"
Global $asNumbers = StringSplit($sVersion, ".")
For $i = 1 To $asNumbers[0]
    If $i = 1 Then
        $sNewVersion = StringFormat("%03i", $asNumbers[$i])
    Else
        $sNewVersion = $sNewVersion & "." & StringFormat("%03i", $asNumbers[$i])
    EndIf
Next
ConsoleWrite($sNewVersion & @CRLF)

Returns: 011.002.002.002


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Excellent! Thanks Water. I was able to implement this in my script and it works great!

Share this post


Link to post
Share on other sites

Glad I could help ;)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Excellent! Thanks Water. I was able to implement this in my script and it works great!

Jeff, would you mind posting a full version of your changes? A script to check and compare flash versions would be extremely helpful to myself, and I am sure others could use it as well!

Thanks in advance

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

There is _VersionCompare...

#include <Misc.au3>

$sVersions1 = '1.0.1.0'
$sVersions2 = '1.0.1.1'

$iResult = _VersionCompare($sVersions1, $sVersions2)
$sResult = "Version 1 is greater"
If $iResult == -1 Then $sResult = "Version 2 is greater"

ConsoleWrite($iResult & ' ' & $sResult & ' ' & $sVersions1 & ' ' & $sVersions2 & @CRLF)
Edited by Robjong

Share this post


Link to post
Share on other sites

Thanks Robjong. I'll take a look at that, as I hadn't seen it before.

Here is the code I now have JerseyzUks. It added a lot more regsitry checked because I found some software adds itself in different places in the registry. It seems to work well, but perhaps messy...

Func _UpdateList()
_GUICtrlListView_DeleteAllItems($listSoftware)
If @OSArch = "x86" Then
  Local $iUpdate = IniReadSection("\\server\share$\software.ini", "ApplicationNamex86")
  Local $uRegKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
  Local $uRegKey2 = "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
  Local $uRegKey3 = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products"
  Local $iString
  $iInstall2 = IniReadSection("\\server\share$\software.ini", "Installx86")
  If IsArray($iUpdate) Then
   For $z = 1 To $iUpdate[0][0]
    _GUICtrlListView_AddSubItem($listSoftware, $z - 1, $iUpdate[$z][1], 1)
    For $v = 1 To $iInstall2[0][0]
     If StringInStr($iUpdate[$z][0], $iInstall2[$v][0]) Then
      $iString = _StringBetween($iInstall2[$v][1], '"', '"')
      If @error Then
       If FileExists($iInstall2[$v][1]) Then
        For $w = 1 To 500
         $AppKey = RegEnumKey($uRegKey, $w)
         If StringInStr(RegRead($uRegKey & "\" & $AppKey, "DisplayName"), $iUpdate[$z][0]) Then
          $uVer = RegRead($uRegKey & "\" & $AppKey, "DisplayVersion")
          _GUICtrlListView_AddSubItem($listSoftware, $z - 1, $uVer, 2)
         EndIf
         $AppKey1 = RegEnumKey($uRegKey2, $w)
         If StringInStr(RegRead($uRegKey2 & "\" & $AppKey1, "DisplayName"), $iUpdate[$z][0]) Then
          $uVer1 = RegRead($uRegKey2 & "\" & $AppKey1, "DisplayVersion")
          _GUICtrlListView_AddSubItem($listSoftware, $z - 1, $uVer1, 2)
         EndIf
         $AppKey2 = RegEnumKey($uRegKey3, $w)
         If StringInStr(RegRead($uRegKey3 & "\" & $AppKey2 & "\InstallProperties", "DisplayName"), $iUpdate[$z][0]) Then
          $uVer2 = RegRead($uRegKey3 & "\" & $AppKey2 & "\InstallProperties", "DisplayVersion")
          _GUICtrlListView_AddSubItem($listSoftware, $z - 1, $uVer2, 2)
         EndIf
        Next
        Local $sVer = $uVer
        Local $sVer1 = $uVer1
        Local $sVer2 = $uVer2
        Local $sNetVersion = $iUpdate[$z][1]
        Local $asNumbersLocal = StringSplit($sVer, ".")
        Local $asNumbersLocal1 = StringSplit($sVer1, ".")
        Local $asNumbersLocal2 = StringSplit($sVer2, ".")
        Local $asNumbersNetwork = StringSplit($sNetVersion, ".")
        Local $updateReq = ""
        If $sVer = "" Then
         For $i = 1 To $asNumbersLocal1[0]
          If $asNumbersLocal1[$i] < $asNumbersNetwork[$i] Then
           $updateReq = True
           ExitLoop
          EndIf
         Next
        ElseIf $sVer1 = "" Then
         For $i = 1 To $asNumbersLocal2[0]
          If $asNumbersLocal2[$i] < $asNumbersNetwork[$i] Then
           $updateReq = True
           ExitLoop
          EndIf
         Next
        Else
         For $i = 1 To $asNumbersLocal[0]
          If $asNumbersLocal[$i] < $asNumbersNetwork[$i] Then
           $updateReq = True
           ExitLoop
          EndIf
         Next
        EndIf
        If $uVer = "" And $uVer1 = "" And $uVer2 = "" Then
         _GUICtrlListView_AddSubItem($listSoftware, $z - 1, "Not installed", 3)
        ElseIf $updateReq = True Then
         _GUICtrlListView_AddSubItem($listSoftware, $z - 1, "Update available", 3)
        Else
         _GUICtrlListView_AddSubItem($listSoftware, $z - 1, "Installed", 3)
        EndIf
       Else
        ;Reload the availability columns
        _GUICtrlListView_AddSubItem($listSoftware, $z - 1, "Unavailable", 3)
       EndIf
       $uVer = ""
       $uVer1 = ""
       $uVer2 = ""
      Else
       If FileExists($iString[0]) Then
        For $w = 1 To 500
         $AppKey = RegEnumKey($uRegKey, $w)
         If StringInStr(RegRead($uRegKey & "\" & $AppKey, "DisplayName"), $iUpdate[$z][0]) Then
          $uVer = RegRead($uRegKey & "\" & $AppKey, "DisplayVersion")
          _GUICtrlListView_AddSubItem($listSoftware, $z - 1, $uVer, 2)
         EndIf
         $AppKey1 = RegEnumKey($uRegKey2, $w)
         If StringInStr(RegRead($uRegKey2 & "\" & $AppKey1, "DisplayName"), $iUpdate[$z][0]) Then
          $uVer1 = RegRead($uRegKey2 & "\" & $AppKey1, "DisplayVersion")
          _GUICtrlListView_AddSubItem($listSoftware, $z - 1, $uVer1, 2)
         EndIf
         $AppKey2 = RegEnumKey($uRegKey3, $w)
         If StringInStr(RegRead($uRegKey3 & "\" & $AppKey2 & "\InstallProperties", "DisplayName"), $iUpdate[$z][0]) Then
          $uVer2 = RegRead($uRegKey3 & "\" & $AppKey2 & "\InstallProperties", "DisplayVersion")
          _GUICtrlListView_AddSubItem($listSoftware, $z - 1, $uVer2, 2)
         EndIf
        Next
        Local $sVer = $uVer
        Local $sVer1 = $uVer1
        Local $sVer2 = $uVer2
        Local $sNetVersion = $iUpdate[$z][1]
        Local $asNumbersLocal = StringSplit($sVer, ".")
        Local $asNumbersLocal1 = StringSplit($sVer1, ".")
        Local $asNumbersLocal2 = StringSplit($sVer2, ".")
        Local $asNumbersNetwork = StringSplit($sNetVersion, ".")
        Local $updateReq = ""
        If $sVer = "" Then
         For $i = 1 To $asNumbersLocal1[0]
          If $asNumbersLocal1[$i] < $asNumbersNetwork[$i] Then
           $updateReq = True
           ExitLoop
          EndIf
         Next
        ElseIf $sVer1 = "" Then
         For $i = 1 To $asNumbersLocal2[0]
          If $asNumbersLocal2[$i] < $asNumbersNetwork[$i] Then
           $updateReq = True
           ExitLoop
          EndIf
         Next
        Else
         For $i = 1 To $asNumbersLocal[0]
          If $asNumbersLocal[$i] < $asNumbersNetwork[$i] Then
           $updateReq = True
           ExitLoop
          EndIf
         Next
        EndIf
        If $uVer = "" And $uVer1 = "" And $uVer2 = "" Then
         _GUICtrlListView_AddSubItem($listSoftware, $z - 1, "Not installed", 3)
        ElseIf $updateReq = True Then
         _GUICtrlListView_AddSubItem($listSoftware, $z - 1, "Update available", 3)
        Else
         _GUICtrlListView_AddSubItem($listSoftware, $z - 1, "Installed", 3)
        EndIf
       Else
        ;Reload the availability columns
        _GUICtrlListView_AddSubItem($listSoftware, $z - 1, "Unavailable", 3)
       EndIf
       $uVer = ""
       $uVer1 = ""
       $uVer2 = ""
      EndIf
     EndIf
    Next
   Next
  EndIf
ElseIf @OSArch = "x64" Then
  Local $iUpdate = IniReadSection("\\server\share$\software.ini", "ApplicationNamex64")
  Local $uRegKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
  Local $uRegKey1 = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
  Local $uRegKey2 = "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
  Local $uRegKey3 = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products"
  $iInstall2 = IniReadSection("\\server\share$\software.ini", "Installx64")
  Local $iString
  If IsArray($iUpdate) Then
   For $z = 1 To $iUpdate[0][0]
    _GUICtrlListView_AddSubItem($listSoftware, $z - 1, $iUpdate[$z][1], 1)
    For $v = 1 To $iInstall2[0][0]
     If StringInStr($iUpdate[$z][0], $iInstall2[$v][0]) Then
      $iString = _StringBetween($iInstall2[$v][1], '"', '"')
      If @error Then
       If FileExists($iInstall2[$v][1]) Then
        For $w = 1 To 500
         $AppKey = RegEnumKey($uRegKey, $w)
         If StringInStr(RegRead($uRegKey & "\" & $AppKey, "DisplayName"), $iUpdate[$z][0]) Then
          $uVer = RegRead($uRegKey & "\" & $AppKey, "DisplayVersion")
          _GUICtrlListView_AddSubItem($listSoftware, $z - 1, $uVer, 2)
         EndIf
         $AppKey1 = RegEnumKey($uRegKey2, $w)
         If StringInStr(RegRead($uRegKey2 & "\" & $AppKey1, "DisplayName"), $iUpdate[$z][0]) Then
          $uVer1 = RegRead($uRegKey2 & "\" & $AppKey1, "DisplayVersion")
          _GUICtrlListView_AddSubItem($listSoftware, $z - 1, $uVer1, 2)
         EndIf
         $AppKey2 = RegEnumKey($uRegKey3, $w)
         If StringInStr(RegRead($uRegKey3 & "\" & $AppKey2 & "\InstallProperties", "DisplayName"), $iUpdate[$z][0]) Then
          $uVer2 = RegRead($uRegKey3 & "\" & $AppKey2 & "\InstallProperties", "DisplayVersion")
          _GUICtrlListView_AddSubItem($listSoftware, $z - 1, $uVer2, 2)
         EndIf
        Next
        Local $sVer = $uVer
        Local $sVer1 = $uVer1
        Local $sVer2 = $uVer2
        Local $sNetVersion = $iUpdate[$z][1]
        Local $asNumbersLocal = StringSplit($sVer, ".")
        Local $asNumbersLocal1 = StringSplit($sVer1, ".")
        Local $asNumbersLocal2 = StringSplit($sVer2, ".")
        Local $asNumbersNetwork = StringSplit($sNetVersion, ".")
        Local $updateReq = ""
        If $sVer = "" Then
         For $i = 1 To $asNumbersLocal1[0]
          If $asNumbersLocal1[$i] < $asNumbersNetwork[$i] Then
           $updateReq = True
           ExitLoop
          EndIf
         Next
        ElseIf $sVer1 = "" Then
         For $i = 1 To $asNumbersLocal2[0]
          If $asNumbersLocal2[$i] < $asNumbersNetwork[$i] Then
           $updateReq = True
           ExitLoop
          EndIf
         Next
        Else
         For $i = 1 To $asNumbersLocal[0]
          If $asNumbersLocal[$i] < $asNumbersNetwork[$i] Then
           $updateReq = True
           ExitLoop
          EndIf
         Next
        EndIf
        If $uVer = "" And $uVer1 = "" And $uVer2 = "" Then
         _GUICtrlListView_AddSubItem($listSoftware, $z - 1, "Not installed", 3)
        ElseIf $updateReq = True Then
         _GUICtrlListView_AddSubItem($listSoftware, $z - 1, "Update available", 3)
        Else
         _GUICtrlListView_AddSubItem($listSoftware, $z - 1, "Installed", 3)
        EndIf
       Else
        ;Reload the availability columns
        _GUICtrlListView_AddSubItem($listSoftware, $z - 1, "Unavailable", 3)
       EndIf
       $uVer = ""
       $uVer1 = ""
       $uVer2 = ""
      Else
       If FileExists($iString[0]) Then
        For $w = 1 To 500
         $AppKey = RegEnumKey($uRegKey, $w)
         If StringInStr(RegRead($uRegKey & "\" & $AppKey, "DisplayName"), $iUpdate[$z][0]) Then
          $uVer = RegRead($uRegKey & "\" & $AppKey, "DisplayVersion")
          _GUICtrlListView_AddSubItem($listSoftware, $z - 1, $uVer, 2)
         EndIf
         $AppKey1 = RegEnumKey($uRegKey2, $w)
         If StringInStr(RegRead($uRegKey2 & "\" & $AppKey1, "DisplayName"), $iUpdate[$z][0]) Then
          $uVer1 = RegRead($uRegKey2 & "\" & $AppKey1, "DisplayVersion")
          _GUICtrlListView_AddSubItem($listSoftware, $z - 1, $uVer1, 2)
         EndIf
         $AppKey2 = RegEnumKey($uRegKey3, $w)
         If StringInStr(RegRead($uRegKey3 & "\" & $AppKey2 & "\InstallProperties", "DisplayName"), $iUpdate[$z][0]) Then
          $uVer2 = RegRead($uRegKey3 & "\" & $AppKey2 & "\InstallProperties", "DisplayVersion")
          _GUICtrlListView_AddSubItem($listSoftware, $z - 1, $uVer2, 2)
         EndIf
        Next
        Local $sVer = $uVer
        Local $sVer1 = $uVer1
        Local $sVer2 = $uVer2
        Local $sNetVersion = $iUpdate[$z][1]
        Local $asNumbersLocal = StringSplit($sVer, ".")
        Local $asNumbersLocal1 = StringSplit($sVer1, ".")
        Local $asNumbersLocal2 = StringSplit($sVer2, ".")
        Local $asNumbersNetwork = StringSplit($sNetVersion, ".")
        Local $updateReq = ""
        If $sVer = "" Then
         For $i = 1 To $asNumbersLocal1[0]
          If $asNumbersLocal1[$i] < $asNumbersNetwork[$i] Then
           $updateReq = True
           ExitLoop
          EndIf
         Next
        ElseIf $sVer1 = "" Then
         For $i = 1 To $asNumbersLocal2[0]
          If $asNumbersLocal2[$i] < $asNumbersNetwork[$i] Then
           $updateReq = True
           ExitLoop
          EndIf
         Next
        Else
         For $i = 1 To $asNumbersLocal[0]
          If $asNumbersLocal[$i] < $asNumbersNetwork[$i] Then
           $updateReq = True
           ExitLoop
          EndIf
         Next
        EndIf
        If $uVer = "" And $uVer1 = "" And $uVer2 = "" Then
         _GUICtrlListView_AddSubItem($listSoftware, $z - 1, "Not installed", 3)
        ElseIf $updateReq = True Then
         _GUICtrlListView_AddSubItem($listSoftware, $z - 1, "Update available", 3)
        Else
         _GUICtrlListView_AddSubItem($listSoftware, $z - 1, "Installed", 3)
        EndIf
       Else
        ;Reload the availability columns
        _GUICtrlListView_AddSubItem($listSoftware, $z - 1, "Unavailable", 3)
       EndIf
       $uVer = ""
       $uVer1 = ""
       $uVer2 = ""
      EndIf
     EndIf
    Next
   Next
  EndIf
  If IsArray($iUpdate) Then
   For $z = 1 To $iUpdate[0][0]
    $text = _GUICtrlListView_GetItemText($listSoftware, $z - 1, 2)
    If $text = "" Then
     _GUICtrlListView_AddSubItem($listSoftware, $z - 1, $iUpdate[$z][1], 1)
     For $v = 1 To $iInstall2[0][0]
      If StringInStr($iUpdate[$z][0], $iInstall2[$v][0]) Then
       $iString = _StringBetween($iInstall2[$v][1], '"', '"')
       If @error Then
        If FileExists($iInstall2[$v][1]) Then
         For $w = 1 To 500
          $AppKey = RegEnumKey($uRegKey1, $w)
          If StringInStr(RegRead($uRegKey1 & "\" & $AppKey, "DisplayName"), $iUpdate[$z][0]) Then
           $uVer = RegRead($uRegKey1 & "\" & $AppKey, "DisplayVersion")
           _GUICtrlListView_AddSubItem($listSoftware, $z - 1, $uVer, 2)
          EndIf
          $AppKey1 = RegEnumKey($uRegKey2, $w)
          If StringInStr(RegRead($uRegKey2 & "\" & $AppKey1, "DisplayName"), $iUpdate[$z][0]) Then
           $uVer1 = RegRead($uRegKey2 & "\" & $AppKey1, "DisplayVersion")
           _GUICtrlListView_AddSubItem($listSoftware, $z - 1, $uVer1, 2)
          EndIf
          $AppKey2 = RegEnumKey($uRegKey3, $w)
          If StringInStr(RegRead($uRegKey3 & "\" & $AppKey2 & "\InstallProperties", "DisplayName"), $iUpdate[$z][0]) Then
           $uVer2 = RegRead($uRegKey3 & "\" & $AppKey2 & "\InstallProperties", "DisplayVersion")
           _GUICtrlListView_AddSubItem($listSoftware, $z - 1, $uVer2, 2)
          EndIf
         Next
         Local $sVer = $uVer
         Local $sVer1 = $uVer1
         Local $sVer2 = $uVer2
         Local $sNetVersion = $iUpdate[$z][1]
         Local $asNumbersLocal = StringSplit($sVer, ".")
         Local $asNumbersLocal1 = StringSplit($sVer1, ".")
         Local $asNumbersLocal2 = StringSplit($sVer2, ".")
         Local $asNumbersNetwork = StringSplit($sNetVersion, ".")
         Local $updateReq = ""
         If $sVer = "" Then
          For $i = 1 To $asNumbersLocal1[0]
           If $asNumbersLocal1[$i] < $asNumbersNetwork[$i] Then
            $updateReq = True
            ExitLoop
           EndIf
          Next
         ElseIf $sVer1 = "" Then
          For $i = 1 To $asNumbersLocal2[0]
           If $asNumbersLocal2[$i] < $asNumbersNetwork[$i] Then
            $updateReq = True
            ExitLoop
           EndIf
          Next
         Else
          For $i = 1 To $asNumbersLocal[0]
           If $asNumbersLocal[$i] < $asNumbersNetwork[$i] Then
            $updateReq = True
            ExitLoop
           EndIf
          Next
         EndIf
         If $uVer = "" And $uVer1 = "" And $uVer2 = "" Then
          _GUICtrlListView_AddSubItem($listSoftware, $z - 1, "Not installed", 3)
         ElseIf $updateReq = True Then
          _GUICtrlListView_AddSubItem($listSoftware, $z - 1, "Update available", 3)
         Else
          _GUICtrlListView_AddSubItem($listSoftware, $z - 1, "Installed", 3)
         EndIf
        Else
         ;Reload the availability columns
         _GUICtrlListView_AddSubItem($listSoftware, $z - 1, "Unavailable", 3)
        EndIf
        $uVer = ""
        $uVer1 = ""
        $uVer2 = ""
       Else
        If FileExists($iString[0]) Then
         For $w = 1 To 500
          $AppKey = RegEnumKey($uRegKey1, $w)
          If StringInStr(RegRead($uRegKey1 & "\" & $AppKey, "DisplayName"), $iUpdate[$z][0]) Then
           $uVer = RegRead($uRegKey1 & "\" & $AppKey, "DisplayVersion")
           _GUICtrlListView_AddSubItem($listSoftware, $z - 1, $uVer, 2)
          EndIf
          $AppKey1 = RegEnumKey($uRegKey2, $w)
          If StringInStr(RegRead($uRegKey2 & "\" & $AppKey1, "DisplayName"), $iUpdate[$z][0]) Then
           $uVer1 = RegRead($uRegKey2 & "\" & $AppKey1, "DisplayVersion")
           _GUICtrlListView_AddSubItem($listSoftware, $z - 1, $uVer1, 2)
          EndIf
          $AppKey2 = RegEnumKey($uRegKey3, $w)
          If StringInStr(RegRead($uRegKey3 & "\" & $AppKey2 & "\InstallProperties", "DisplayName"), $iUpdate[$z][0]) Then
           $uVer2 = RegRead($uRegKey3 & "\" & $AppKey2 & "\InstallProperties", "DisplayVersion")
           _GUICtrlListView_AddSubItem($listSoftware, $z - 1, $uVer2, 2)
          EndIf
         Next
         Local $sVer = $uVer
         Local $sVer1 = $uVer1
         Local $sVer2 = $uVer2
         Local $sNetVersion = $iUpdate[$z][1]
         Local $asNumbersLocal = StringSplit($sVer, ".")
         Local $asNumbersLocal1 = StringSplit($sVer1, ".")
         Local $asNumbersLocal2 = StringSplit($sVer2, ".")
         Local $asNumbersNetwork = StringSplit($sNetVersion, ".")
         Local $updateReq = ""
         If $sVer = "" Then
          For $i = 1 To $asNumbersLocal1[0]
           If $asNumbersLocal1[$i] < $asNumbersNetwork[$i] Then
            $updateReq = True
            ExitLoop
           EndIf
          Next
         ElseIf $sVer1 = "" Then
          For $i = 1 To $asNumbersLocal2[0]
           If $asNumbersLocal2[$i] < $asNumbersNetwork[$i] Then
            $updateReq = True
            ExitLoop
           EndIf
          Next
         Else
          For $i = 1 To $asNumbersLocal[0]
           If $asNumbersLocal[$i] < $asNumbersNetwork[$i] Then
            $updateReq = True
            ExitLoop
           EndIf
          Next
         EndIf
         If $uVer = "" And $uVer1 = "" And $uVer2 = "" Then
          _GUICtrlListView_AddSubItem($listSoftware, $z - 1, "Not installed", 3)
         ElseIf $updateReq = True Then
          _GUICtrlListView_AddSubItem($listSoftware, $z - 1, "Update available", 3)
         Else
          _GUICtrlListView_AddSubItem($listSoftware, $z - 1, "Installed", 3)
         EndIf
        Else
         ;Reload the availability columns
         _GUICtrlListView_AddSubItem($listSoftware, $z - 1, "Unavailable", 3)
        EndIf
        $uVer = ""
        $uVer1 = ""
        $uVer2 = ""
       EndIf
      EndIf
     Next
    EndIf
   Next
  EndIf
EndIf
EndFunc   ;==>_UpdateList

Here is the bit you were referring too.

Local $sVer = $uVer
         Local $sVer1 = $uVer1
         Local $sVer2 = $uVer2
         Local $sNetVersion = $iUpdate[$z][1]
         Local $asNumbersLocal = StringSplit($sVer, ".")
         Local $asNumbersLocal1 = StringSplit($sVer1, ".")
         Local $asNumbersLocal2 = StringSplit($sVer2, ".")
         Local $asNumbersNetwork = StringSplit($sNetVersion, ".")
         Local $updateReq = ""
         If $sVer = "" Then
          For $i = 1 To $asNumbersLocal1[0]
           If $asNumbersLocal1[$i] < $asNumbersNetwork[$i] Then
            $updateReq = True
            ExitLoop
           EndIf
          Next
         ElseIf $sVer1 = "" Then
          For $i = 1 To $asNumbersLocal2[0]
           If $asNumbersLocal2[$i] < $asNumbersNetwork[$i] Then
            $updateReq = True
            ExitLoop
           EndIf
          Next
         Else
          For $i = 1 To $asNumbersLocal[0]
           If $asNumbersLocal[$i] < $asNumbersNetwork[$i] Then
            $updateReq = True
            ExitLoop
           EndIf
          Next
         EndIf
         If $uVer = "" And $uVer1 = "" And $uVer2 = "" Then
          _GUICtrlListView_AddSubItem($listSoftware, $z - 1, "Not installed", 3)
         ElseIf $updateReq = True Then
          _GUICtrlListView_AddSubItem($listSoftware, $z - 1, "Update available", 3)
         Else
          _GUICtrlListView_AddSubItem($listSoftware, $z - 1, "Installed", 3)
         EndIf
        Else
         ;Reload the availability columns
         _GUICtrlListView_AddSubItem($listSoftware, $z - 1, "Unavailable", 3)
        EndIf
        $uVer = ""
        $uVer1 = ""
        $uVer2 = ""

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  
Followers 0