Jump to content

Batch help (File version checker)


Recommended Posts

Hi everyone,

I have been interested in updating my current checker bat file to a nice GUI using Autoit. Would it be easier to call apon the batch file or to recreate it? I would like to have all this done in the background and possibly have the gui reflect what is being checked in realtime (not sure if this is possible). Maybe even making a list of what needs to be installed/updated, possibly a buttom you have to press to continue.

This is piece that I use to check for different files inorder to verify the version installed. If the version is installed and up to date it will skip and move on to the next sigcheck. If the sigcheck dosnt match then it runs an installer.

ECHO        Checking for Java6 Update 16..
        for /f %%a in ('\\server\APPS2\sigcheck.exe -q -n "C:\Program Files\Java\jre6\bin\java.dll"') do set ver=%%a
        set ver=%ver: =.%
        set ver=%ver:,=.%
        if "%ver%"=="6.0.160.1" ECHO %date% %TIME% - Java 6 update 16 is currently installed on %computername% >> %InstallLog%
        if "%ver%"=="6.0.160.1" goto next_application   
            ECHO            Installing Java Update 16..
            ECHO %date% %TIME% - Installing Java Update 16.. >> %InstallLog%
                Start /wait \\server\APPS2\Menu\Java6_16.bat

Thanks in advance!

Frank

Link to comment
Share on other sites

Link to comment
Share on other sites

Start small then work up to it. Post your code here as you go. Have a look at Run, ConsoleWrite and Local (variables)

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Link to comment
Share on other sites

so far this is working, I know its very basic but I have little scripting background.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Run_Tidy=y
#AutoIt3Wrapper_Tidy_Stop_onerror=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
$java_vers = FileGetVersion("C:\Program Files\Java\jre6\bin\java.dll")

If FileExists("C:\Program Files\Java\jre6\bin\java.dll") Then
    MsgBox(0, "Lets compare", "Lets see if its the latest version")
EndIf
If $java_vers < "6.0.170.4" Then
    MsgBox(0, "aww..", "Looks like java is out of date")
ElseIf $java_vers = "6.0.170.4" Then
    MsgBox(0, "latest", "Java is up to date")
EndIf

Exit

It works on machines that have the older version of java. :D

so far so good?

Frank

Link to comment
Share on other sites

Looks good, told me my version is out of date (which I know) so it works!

For the update look at something like RunWait('\\server\APPS2\Menu\Java6_16.bat').

It appears you want to do this for a number of applications, I would recommend you put each check and update in a function then call in one body.

Example:

UpdateJava() - contains the checking as posted and the update if required.

UpdateFoo() - same but with the foo applocation.

This will remove the need for the dreaded goto (goto next_application) in you batch script.

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Link to comment
Share on other sites

I would probably make it a single function like:

_CheckIfUpdate ($sPath, $vLatest, $sName)

Where:

$sPath = Path to the file we are checking.

$vLatest = The latest version in the form of X.X.X.X or whatever.

$sName = The name of the program so we can dynamically change the name in the MsgBox like so. The & is how we join the string and the variable together or a string and the return from a function or a macro. Basically joins two things together.

MsgBox (0, "awww...", "It looks like " & $sName & " is out of date!)

As for comparing your version I would try the following, much more efficent and fool proof compared to your current methodology.

If _VersionCompare($FileVersion, $vLatest) <> -1 Then ;Then the second version is greater.
;We have the latest
else
;We are out of date
EndIf

Cheers

Brett

Edited by BrettF
Link to comment
Share on other sites

You guys are awesome! thanks for keeping me on track. I was starting to get the hang of things and am really started to get into this kinda stuff. Ima geek to the core :D

Any thoughts on making this fancy whith a gui and such. Id like to have a gui show the output and let it reflect what version is present on the machine.

ill post again tommorow with a more robust check format from the example you two have givin.

thanks again

Link to comment
Share on other sites

The dressing is really up to you. It can be done in GUI with a progress bar or a tool tip, decide how you want it displayed then have a look in the help file for what you need. An other idea is to list the applications then tick them as they are checked/updated. I have seen Norton AV do this, it is up to u.

Feel free to put in any suggestions Brett :D I see ur viewing while I am posting.

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Link to comment
Share on other sites

Thanks guys! I have got it into a function form and was wondering if you can point me towards the right commands. Do I need to used message loop or on event? Do you know if any examples that might help with the dressing up part? sorry for being a noob per say lol

Thanks again

Frank

here is what I have so far. I did this before reading your posts about functions so please be nice lol

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Run_Tidy=y
#AutoIt3Wrapper_Tidy_Stop_onerror=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Checker", 246, 256, 381, 113)
$Button1 = GUICtrlCreateButton("Check", 80, 224, 75, 25, $WS_GROUP)
GUICtrlSetBkColor(-1, 0xC0C0C0)
$Group1 = GUICtrlCreateGroup("Applications", 0, 8, 244, 200)
$Java = GUICtrlCreateLabel("Java", 16, 40, 27, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
;==================================
;==================================
;====== Define all Variables =====
;==================================
;==================================
Local $java_vers = FileGetVersion("C:\Program Files\Java\jre6\bin\java.dll")
;==================================
;==================================
;====== End of Variables===========
;==================================
;==================================
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            version_check("Java", "C:\Program Files\Java\jre6\bin\java.dll")
    EndSwitch
WEnd



;=======================================================================================
;====== Define all functions
;=======================================================================================
Func version_check($name, $path)
    If FileExists($path) Then
        MsgBox(0, $name, "Lets see if its the latest version")
    EndIf
    If $java_vers < "6.0.170.4" Then
        MsgBox(0, "$name", "Looks like this app is out of date")
    ElseIf $java_vers = "6.0.170.4" Then
        MsgBox(0, $name, "This app is up to date")
    EndIf
EndFunc   ;==>version_check

Exit
Link to comment
Share on other sites

What you have appears to be fine. The version_check appears to work correctly so I would not change it. The While look looks good, I would keep that.

Read up on some GUI functions and search the forum for examples (you will find many).

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Link to comment
Share on other sites

Ok so far I have managed to use an example from the forums to come up with this:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

;====== Define all Variables =====
Local $JavaFileVersion = FileGetVersion("C:\Program Files\Java\jre6\bin\java.dll")
Global $conf, $t
;====== End of Variables===========


#Region ### START Koda GUI section ### Form=
$Form1_1 = GUICreate("Checker", 309, 258, 255, 110)
$Button1 = GUICtrlCreateButton("Check PC", 80, 225, 131, 25, $WS_GROUP)
GUICtrlSetBkColor(-1, 0xC0C0C0)
$Group1 = GUICtrlCreateGroup("Applications", 0, 0, 140, 223)
$Java = GUICtrlCreateLabel("Java", 8, 15, 27, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Version", 144, 0, 130, 223)
$Label1 = GUICtrlCreateLabel($t, 151, 16, 85, 16)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Func version_check($name, $path)
    If FileExists($path) Then
        _check(1)
    EndIf
    If $JavaFileVersion < "6.0.170.4" Then
        MsgBox(0, "$name", "Looks like " & $name & " is out of date!")
    ElseIf $JavaFileVersion = "6.0.170.4" Then
        MsgBox(0, $name, "" & $name & " is up to date! :-)")
    EndIf
EndFunc   ;==>version_check

Func _check($lab)
    If $lab = 1 Then
        $t = " Java is current"
        GUICtrlSetData($Label1, $t)
        Return $t
    ElseIf $lab = 2 Then
        $t = "text2"
        GUICtrlSetData($Label1, $t)
        Return $t
    Else
        $t = "text-no"
        GUICtrlSetData($Label1, $t)
        Return $t
    EndIf
EndFunc   ;==>_check


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            version_check("Java", "C:\Program Files\Java\jre6\bin\java.dll")
    EndSwitch
WEnd




Exit

The goal was to get the label to be dynamic and to have it update the field as it was checking. I know that its a bit messy but my next step is to figure out how to make a function. So that I can code the rest of the standard apps without to much of a headache.

Any thoughts?

Link to comment
Share on other sites

InetGet means that it will get information or files, look help file i will include some files to help you understand. :D

You can make it download the new update and start install by this script. You can even make a update.dat to show where to download new version so try this.

Local $hDownload = InetGet("http://www.autoitscript.com/autoit3/files/beta/update.dat", @TempDir & "\update.dat", 1, 1)    ; It will look for file from the update.dat file
    Do
    Sleep(250)
    Until InetGetInfo($hDownload, 2)    ; Check if the download is complete.
    Local $nBytes = InetGetInfo($hDownload, 0)
    InetClose($hDownload)   ; Close the handle to release resourcs.
    MsgBox(0, "", "Bytes read: " & $nBytes)

[AutoIt]
version=3.3.4.0
index=http://www.autoitscript.com/autoit3/downloads.php
setup=http://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/autoit-v3.3.4.0-setup.exe
filesize=8424424
filetime=20100115161309

[AutoItBeta]
version=3.3.5.1
index=http://www.autoitscript.com/autoit3/files/beta/autoit/
setup=http://www.autoitscript.com/autoit3/files/beta/autoit/autoit-v3.3.5.1-beta-setup.exe
filesize=8182264
filetime=20100126123308

test.zip

Edited by DarkHo
Link to comment
Share on other sites

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=test.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_Fileversion=0.1.0.1
#AutoIt3Wrapper_Res_FileVersion_AutoIncrement=p
#AutoIt3Wrapper_Run_Tidy=y
#AutoIt3Wrapper_Tidy_Stop_onerror=n
#Obfuscator_Parameters=/striponly
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#Region
#EndRegion

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

;====== Define all Variables =====
Global $conf, $t
Local $Java = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{26A24AE4-039D-4CA4-87B4-2F83216017FF}", "DisplayVersion")
Local $Adobe = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{AC76BA86-1033-0000-BA7E-000000000004}", "DisplayVersion")
Local $AC62 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{1BE8806A-84F8-4655-A381-0D5524430944}", "DisplayVersion")
Local $AC62P = RegRead("HKEY_CLASSES_ROOT\Installer\Patches\01673DE8C241AFF45B99D6FC2BD3D86F\SourceList", "PackageName")
Local $Flash = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player ActiveX", "DisplayVersion")
Local $DBsign = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{44D21B77-D4FC-49E8-A726-CD00D5016703}", "DisplayVersion")
;====== End of Variables==========

#Region ### START Koda GUI section ### Form=
$Form1_1 = GUICreate("Checker", 275, 252, 255, 110)
$Button1 = GUICtrlCreateButton("Check PC", 76, 225, 131, 25, $WS_GROUP)
GUICtrlSetBkColor(-1, 0xC0C0C0)
$Group1 = GUICtrlCreateGroup("Applications", 0, 0, 140, 223)
$la_ActivClient = GUICtrlCreateLabel("ActivClient", 10, 15, 80, 15)
$la_AcrobatReader = GUICtrlCreateLabel("Adobe Acrobat Reader", 10, 30, 110, 15)
$la_AdobeFlash = GUICtrlCreateLabel("Adobe Flash", 10, 45, 80, 15)
$la_Java = GUICtrlCreateLabel("Java", 10, 75, 80, 15)
$la_DBSign = GUICtrlCreateLabel("DBSign", 10, 60, 80, 15)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Version", 144, 0, 130, 223)
$LabelActivClient = GUICtrlCreateLabel($t, 154, 15, 110, 15)
$LabelAcrobatReader = GUICtrlCreateLabel($t, 154, 30, 110, 15)
$LabelFlash = GUICtrlCreateLabel($t, 154, 45, 110, 15)
$LabelDBSign = GUICtrlCreateLabel($t, 154, 60, 110, 15)
$LabelJava = GUICtrlCreateLabel($t, 154, 75, 110, 15)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

;====== Start Checker Section =====

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            Locate("C:\Program Files\Java\jre6\bin\java.dll")
    EndSwitch
WEnd

;====== End Checker Section =======

;====== Functions =================
Func locate($Path)
    If FileExists($Path) Then
        _check(1)
    Else
        _check(2)
    EndIf
EndFunc   ;==>locate

Func _check($lab)
    If $lab = 1 Then
        $t = $Java
        GUICtrlSetData($LabelJava, $t)
        Return $t
    ElseIf $lab = 2 Then
        $t = "Not Installed"
        GUICtrlSetData($LabelJava, $t)
        Return $t
    Else
        $t = "text-no"
        GUICtrlSetData($LabelJava, $t)
        Return $t
    EndIf
EndFunc   ;==>_check
Exit

Ok so far i have a few variables set based on the version found in the registry. That seems easier to me then to compair them. I am stuck on creating the functions. I can do it for java but am confused on where to go from here. I think i have a mental block lol

-Frank

Link to comment
Share on other sites

Time to jump into arrays. I hope you can follow this and that it was what you were after. I didn't like your GUI so I changed it... Any questions just ask :D

;=======================================================================
;                           INCLUDE CONSTANTS
;=======================================================================
#Include <GuiListView.au3>
#Include <Misc.au3>
;=======================================================================
;                               VARIABLES
;=======================================================================

;=======================================================================
;                       CURRENT VERSION ARRAY
;=======================================================================
Global $aVersions[6][5]

$aVersions[0][0] = "Java"
$aVersions[0][1] = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{26A24AE4-039D-4CA4-87B4-2F83216017FF}", "DisplayVersion")
$aVersions[0][2] = "0.0.0.0"
$aVersions[0][3] = "C:\Program Files\Java\jre6\bin\java.dll"
$aVersions[0][4] = "Updater Installer Path or whatever"

$aVersions[1][0] = "Adobe"
$aVersions[1][1] = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{AC76BA86-1033-0000-BA7E-000000000004}", "DisplayVersion")
$aVersions[1][2] = "0.0.0.0"
$aVersions[1][3] = ""
$aVersions[1][4] = "Updater Installer Path or whatever"

$aVersions[2][0] = "AC62"
$aVersions[2][1] = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{1BE8806A-84F8-4655-A381-0D5524430944}", "DisplayVersion")
$aVersions[2][2] = "0.0.0.0"
$aVersions[2][3] = ""
$aVersions[2][4] = "Updater Installer Path or whatever"

$aVersions[3][0] = "AC62P"
$aVersions[3][1] = RegRead("HKEY_CLASSES_ROOT\Installer\Patches\01673DE8C241AFF45B99D6FC2BD3D86F\SourceList", "PackageName")
$aVersions[3][2] = "0.0.0.0"
$aVersions[3][3] = ""
$aVersions[3][4] = "Updater Installer Path or whatever"

$aVersions[4][0] = "Flash"
$aVersions[4][1] = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player ActiveX", "DisplayVersion")
$aVersions[4][2] = "0.0.0.0"
$aVersions[4][3] = ""
$aVersions[4][4] = "Updater Installer Path or whatever"

$aVersions[5][0] = "DB Sign"
$aVersions[5][1] = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{44D21B77-D4FC-49E8-A726-CD00D5016703}", "DisplayVersion")
$aVersions[5][2] = "0.0.0.0"
$aVersions[5][3] = ""
$aVersions[5][4] = "Updater Installer Path or whatever"

;=======================================================================
;                           CREATE GUI
;=======================================================================
$GUI = GUICreate ("Installed Programs Version Checker & Updater Thingo", 480, 240)
$button = GUICtrlCreateButton ("Check Version", 395, 215, 80, 20)
$listview = GUICtrlCreateListView ("", 5, 5, 470, 205)
_GUICtrlListView_AddColumn ($listview, "Program Name", 180)
_GUICtrlListView_AddColumn ($listview, "Current Version", 95)
_GUICtrlListView_AddColumn ($listview, "Latest Version", 90)
_GUICtrlListView_AddColumn ($listview, "Status", 100)

For $i = 1 to UBound ($aVersions) -1
    $x = _GUICtrlListView_AddItem ($listview, $aVersions[$i][0])
    _GUICtrlListView_AddSubItem ($listview, $x, $aVersions[$i][1], 1)
    _GUICtrlListView_AddSubItem ($listview, $x, $aVersions[$i][2], 2)
Next

GUISetState (@SW_SHOW)
;=======================================================================
;                           GUI MESSAGE LOOP
;=======================================================================
While 1
    $nMsg = GUIGetMsg ()
    Select
        Case $nMsg = -3
            Exit
        Case $nMsg = $button
            $index =  _GUICtrlListView_GetSelectedIndices($listview)
            _CheckVersion ($index, $aVersions[$index][0], $aVersions[$index][1], $aVersions[$index][2], $aVersions[$index][3])
    EndSelect
WEnd

;=======================================================================
;                               FUNCTIONS
;=======================================================================
Func _CheckVersion ($i, $name, $current, $latest, $path)
    If Not FileExists ($path) Then
        _GUICtrlListView_SetItemText ($listview, $i, "Doesn't Exist", 3)
        Return 0
    EndIf
    $check = _VersionCompare ($current, $latest)
    If $check <= 0 Then
        _GUICtrlListView_SetItemText ($listview, $i, "Up to date", 3)
    ElseIf $check = -1 Then
        _GUICtrlListView_SetItemText ($listview, $i, "Out of date", 3)
        $resp = MsgBox (20, $name & "is not up to date.", $name & " has a newer version available.  Would you like to update?")
        If $resp = 6 Then
            _Update ($i)
        EndIf
    Else
        _GUICtrlListView_SetItemText ($listview, $i, "Unknown", 3)
    EndIf
EndFunc

Func _Update ($i)
    ;Run ($aVersions[$i][4])
    _GUICtrlListView_SetItemText ($listview, $i, "Up to date", 3)
EndFunc
Link to comment
Share on other sites

so much to learn lol. I do like the the array idea. Your gui is very basic and right to the point. I was playing with the version numbers and such. Even if i change the value of say adobe reader and give it a path to check it still says up to date. Also i can only get one line to process when i press check version. If i select (highlight) another line and press check version it outputs and checks that line. I also couldnt get Java to show up in the list under program names. :D

Ill poke around with it throughout the day and see what else i can learn from it.

EDIT**

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=Advanced checker.exe
#AutoIt3Wrapper_Res_Fileversion=0.0.0.1
#AutoIt3Wrapper_Res_FileVersion_AutoIncrement=y
#AutoIt3Wrapper_Run_Tidy=y
#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/striponly
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;=======================================================================
;                           INCLUDE CONSTANTS
;=======================================================================
#include <GuiListView.au3>
#include <Misc.au3>
;=======================================================================
;                               VARIABLES
;=======================================================================

;=======================================================================
;                       CURRENT VERSION ARRAY
;=======================================================================
Global $aVersions[6][5]

$aVersions[0][0] = "Java"
$aVersions[0][1] = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{26A24AE4-039D-4CA4-87B4-2F83216017FF}", "DisplayVersion")
$aVersions[0][2] = "6.0.170"
$aVersions[0][3] = "C:\Program Files\Java\jre6\bin\java.dll"
$aVersions[0][4] = "Updater Installer Path or whatever"

$aVersions[1][0] = "Adobe"
$aVersions[1][1] = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{AC76BA86-1033-0000-BA7E-000000000004}", "DisplayVersion")
$aVersions[1][2] = "9.3.0"
$aVersions[1][3] = "C:\Program Files\Adobe\Acrobat 9.0\Acrobat"
$aVersions[1][4] = "Updater Installer Path or whatever"

$aVersions[2][0] = "AC62"
$aVersions[2][1] = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{1BE8806A-84F8-4655-A381-0D5524430944}", "DisplayVersion")
$aVersions[2][2] = "6.2"
$aVersions[2][3] = "c:\Program Files\ActivIdentity\ActivClient"
$aVersions[2][4] = "Updater Installer Path or whatever"

$aVersions[3][0] = "AC62P"
$aVersions[3][1] = RegRead("HKEY_CLASSES_ROOT\Installer\Patches\01673DE8C241AFF45B99D6FC2BD3D86F\SourceList", "PackageName")
$aVersions[3][2] = "FIX0909009.msp"
$aVersions[3][3] = "c:\Program Files\ActivIdentity\ActivClient"
$aVersions[3][4] = "Updater Installer Path or whatever"

$aVersions[4][0] = "Flash"
$aVersions[4][1] = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player ActiveX", "DisplayVersion")
$aVersions[4][2] = "10.0.42.34"
$aVersions[4][3] = "C:\WINDOWS\system32\Macromed\Flash"
$aVersions[4][4] = "Updater Installer Path or whatever"

$aVersions[5][0] = "DB Sign"
$aVersions[5][1] = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{44D21B77-D4FC-49E8-A726-CD00D5016703}", "DisplayVersion")
$aVersions[5][2] = "2.3"
$aVersions[5][3] = "C:\Program Files\Gradkell Systems, Inc\DBsign Web Signer"
$aVersions[5][4] = "Updater Installer Path or whatever"


;=======================================================================
;                           CREATE GUI
;=======================================================================
$GUI = GUICreate("Installed Programs Version Checker & Updater Thingo", 480, 240)
$button = GUICtrlCreateButton("Check Version", 395, 215, 80, 20)
$listview = GUICtrlCreateListView("", 5, 5, 470, 205)
_GUICtrlListView_AddColumn($listview, "Program Name", 180)
_GUICtrlListView_AddColumn($listview, "Current Version", 95)
_GUICtrlListView_AddColumn($listview, "Latest Version", 90)
_GUICtrlListView_AddColumn($listview, "Status", 100)

For $i = 0 To UBound($aVersions) - 1
    $x = _GUICtrlListView_AddItem($listview, $aVersions[$i][0])
    _GUICtrlListView_AddSubItem($listview, $x, $aVersions[$i][1], 1)
    _GUICtrlListView_AddSubItem($listview, $x, $aVersions[$i][2], 2)
Next

GUISetState(@SW_SHOW)
;=======================================================================
;                           GUI MESSAGE LOOP
;=======================================================================
While 1
    $nMsg = GUIGetMsg()
    Select
        Case $nMsg = -3
            Exit
        Case $nMsg = $button
            $index = _GUICtrlListView_GetSelectedIndices($listview)
            _CheckVersion($index, $aVersions[$index][0], $aVersions[$index][1], $aVersions[$index][2], $aVersions[$index][3])
    EndSelect
WEnd

;=======================================================================
;                               FUNCTIONS
;=======================================================================
Func _CheckVersion($i, $name, $current, $latest, $path)
    If Not FileExists($path) Then
        _GUICtrlListView_SetItemText($listview, $i, "Doesn't Exist", 3)
        Return 0
    EndIf
    $check = _VersionCompare($current, $latest)
    If $check >= 0 Then
        _GUICtrlListView_SetItemText($listview, $i, "Up to date", 3)
    ElseIf $check = -1 Then
        _GUICtrlListView_SetItemText($listview, $i, "Out of date", 3)
        $resp = MsgBox(20, $name & " is not up to date.", $name & " has a newer version available.  Would you like to update?")
        If $resp = 6 Then
            _Update($i)
        EndIf
    Else
        _GUICtrlListView_SetItemText($listview, $i, "Unknown", 3)
    EndIf
EndFunc   ;==>_CheckVersion

Func _Update($i)
    ;run ($aVersions[$i][4])
    _GUICtrlListView_SetItemText($listview, $i, "Up to date", 3)
EndFunc   ;==>_Update

After playing around with it for a few mintutes i got it work alittle better. First I changed:

For $i = 0 To UBound($aVersions) - 1
From
For $i = 1 To UBound($aVersions) - 1

This let the java entry show up in the list view.

I also changed:

If $check >= 0 Then
From
If $check <= 0 Then

This let me compare the versions correctly.

I would really like to have this all run at one time. Example. If I press check PC can everything be done at one time as opossed to one application at a time. I have only listed a few apps but we do have 20+ so one at a time wouldnt be practicle.

Edited by KoolFrank87
Link to comment
Share on other sites

so much to learn lol. I do like the the array idea. Your gui is very basic and right to the point. I was playing with the version numbers and such. Even if i change the value of say adobe reader and give it a path to check it still says up to date.

Not sure atm. I think you fixed that but then it didn't seem to like me either :S

Also i can only get one line to process when i press check version. If i select (highlight) another line and press check version it outputs and checks that line.

That is the way I designed it.

I also couldnt get Java to show up in the list under program names. :D

Ill poke around with it throughout the day and see what else i can learn from it.

After playing around with it for a few mintutes i got it work alittle better. First I changed:

For $i = 0 To UBound($aVersions) - 1
From
For $i = 1 To UBound($aVersions) - 1

This let the java entry show up in the list view.

I also changed:

If $check >= 0 Then
From
If $check <= 0 Then

This let me compare the versions correctly.

I wrote it quickly without properly testing. My bad! :

I would really like to have this all run at one time. Example. If I press check PC can everything be done at one time as opossed to one application at a time. I have only listed a few apps but we do have 20+ so one at a time wouldnt be practicle.

Hmm not too hard. I made it a little bit better :D See the following. Still majorly untested my end... :)

;=======================================================================
;                           INCLUDE CONSTANTS
;=======================================================================
#include <GuiListView.au3>
#include <Misc.au3>
;=======================================================================
;                               VARIABLES
;=======================================================================

;1 = Always update, 2 = Ask to update, 3 = never update
$iUPDATE = 1

;=======================================================================
;                       CURRENT VERSION ARRAY
;=======================================================================
Global $aVersions[6][5]

$aVersions[0][0] = "Java"
$aVersions[0][1] = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{26A24AE4-039D-4CA4-87B4-2F83216017FF}", "DisplayVersion")
$aVersions[0][2] = "6.0.170"
$aVersions[0][3] = "C:\Program Files\Java\jre6\bin\java.dll"
$aVersions[0][4] = "Updater Installer Path or whatever"

$aVersions[1][0] = "Adobe"
$aVersions[1][1] = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{AC76BA86-1033-0000-BA7E-000000000004}", "DisplayVersion")
$aVersions[1][2] = "9.3.0"
$aVersions[1][3] = "C:\Program Files\Adobe\Acrobat 9.0\Acrobat"
$aVersions[1][4] = "Updater Installer Path or whatever"

$aVersions[2][0] = "AC62"
$aVersions[2][1] = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{1BE8806A-84F8-4655-A381-0D5524430944}", "DisplayVersion")
$aVersions[2][2] = "6.2"
$aVersions[2][3] = "c:\Program Files\ActivIdentity\ActivClient"
$aVersions[2][4] = "Updater Installer Path or whatever"

$aVersions[3][0] = "AC62P"
$aVersions[3][1] = RegRead("HKEY_CLASSES_ROOT\Installer\Patches\01673DE8C241AFF45B99D6FC2BD3D86F\SourceList", "PackageName")
$aVersions[3][2] = "FIX0909009.msp"
$aVersions[3][3] = "c:\Program Files\ActivIdentity\ActivClient"
$aVersions[3][4] = "Updater Installer Path or whatever"

$aVersions[4][0] = "Flash"
$aVersions[4][1] = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player ActiveX", "DisplayVersion")
$aVersions[4][2] = "10.0.42.34"
$aVersions[4][3] = "C:\WINDOWS\system32\Macromed\Flash"
$aVersions[4][4] = "Updater Installer Path or whatever"

$aVersions[5][0] = "DB Sign"
$aVersions[5][1] = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{44D21B77-D4FC-49E8-A726-CD00D5016703}", "DisplayVersion")
$aVersions[5][2] = "2.3"
$aVersions[5][3] = "C:\Program Files\Gradkell Systems, Inc\DBsign Web Signer"
$aVersions[5][4] = "Updater Installer Path or whatever"


;=======================================================================
;                           CREATE GUI
;=======================================================================
$GUI = GUICreate("Installed Programs Version Checker & Updater Thingo", 480, 240)
$check_selected = GUICtrlCreateButton("Check Selected", 385, 215, 90, 20)
$check_all = GUICtrlCreateButton("Check All", 300, 215, 80, 20)
$listview = GUICtrlCreateListView("", 5, 5, 470, 205)
_GUICtrlListView_AddColumn($listview, "Program Name", 180)
_GUICtrlListView_AddColumn($listview, "Current Version", 95)
_GUICtrlListView_AddColumn($listview, "Latest Version", 90)
_GUICtrlListView_AddColumn($listview, "Status", 100)

For $i = 0 To UBound($aVersions) - 1
    $x = _GUICtrlListView_AddItem($listview, $aVersions[$i][0])
    _GUICtrlListView_AddSubItem($listview, $x, $aVersions[$i][1], 1)
    _GUICtrlListView_AddSubItem($listview, $x, $aVersions[$i][2], 2)
Next

GUISetState(@SW_SHOW)
;=======================================================================
;                           GUI MESSAGE LOOP
;=======================================================================
While 1
    $nMsg = GUIGetMsg()
    Select
        Case $nMsg = -3
            Exit
        Case $nMsg = $check_selected
            $index = _GUICtrlListView_GetSelectedIndices($listview)
            _CheckVersion($index, $aVersions[$index][0], $aVersions[$index][1], $aVersions[$index][2], $aVersions[$index][3])
        Case $nMsg = $check_all
            For $a = 0 To UBound ($aVersions) - 1
                _CheckVersion($a, $aVersions[$a][0], $aVersions[$a][1], $aVersions[$a][2], $aVersions[$a][3])
            Next
    EndSelect
WEnd

;=======================================================================
;                               FUNCTIONS
;=======================================================================
Func _CheckVersion($i, $name, $current, $latest, $path)
    If Not FileExists($path) Then
        _GUICtrlListView_SetItemText($listview, $i, "Doesn't Exist", 3)
        ;Return 0
    EndIf
    $check = _VersionCompare($current, $latest)
    If $check >= 0 Then
        _GUICtrlListView_SetItemText($listview, $i, "Up to date", 3)
    ElseIf $check = -1 Then
        _GUICtrlListView_SetItemText($listview, $i, "Out of date", 3)
        If $iUPDATE = 1 Then
            _Update($i)
        ElseIf $iUPDATE = 2 Then
            $resp = MsgBox(20, $name & "is not up to date.", $name & " has a newer version available.  Would you like to update?")
            If $resp = 6 Then
                _Update($i)
            EndIf
        EndIf
    Else
        _GUICtrlListView_SetItemText($listview, $i, "Unknown", 3)
    EndIf
EndFunc   ;==>_CheckVersion

Func _Update($i)
    ;Run ($aVersions[$i][4])
    ;_GUICtrlListView_SetItemText($listview, $i, "Up to date", 3)
EndFunc   ;==>_Update

Something more to play with... :huggles:

Edited by BrettF
Link to comment
Share on other sites

hey guys,

I am a complete newbie - and found your code development post. Your comes very handy for a little Installer I am building right now. Could i possibly make use of it?

There is another question I have for you - as I found out, the keys I have in my registry differ from your keys, is it due to different language versions? Are the keys changing over time - depending on the Versions I use - for example does Adobe Acrobat Reader 8 - use a different key than Adobe Acrobat Reader 9 ? Are the keys different depending on the Windows Versions? (XP. Vista, 7...) - I'll post your code whith slightly altered keys - which works for my German Windows 7...

;=======================================================================
;                           INCLUDE CONSTANTS
;=======================================================================
#include <GuiListView.au3>
#include <Misc.au3>
;=======================================================================
;                               VARIABLES
;=======================================================================

;1 = Always update, 2 = Ask to update, 3 = never update
$iUPDATE = 1

;=======================================================================
;                       CURRENT VERSION ARRAY
;=======================================================================
Global $aVersions[6][5]

$aVersions[0][0] = "Java"
$aVersions[0][1] = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{26A24AE4-039D-4CA4-87B4-2F83216017FF}", "DisplayVersion")
$aVersions[0][2] = "6.0.170"
$aVersions[0][3] = "C:\Program Files\Java\jre6\bin\java.dll"
$aVersions[0][4] = "Updater Installer Path or whatever"

$aVersions[1][0] = "Adobe Acrobat"
$aVersions[1][1] = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{AC76BA86-1033-F400-7760-000000000004}", "DisplayVersion")
$aVersions[1][2] = "9.3.0"
$aVersions[1][3] = "C:\Program Files\Adobe\Acrobat 9.0\Acrobat"
$aVersions[1][4] = "Updater Installer Path or whatever"

$aVersions[2][0] = "Quick Time"
$aVersions[2][1] = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{1451DE6B-ABE1-4F62-BE9A-B363A17588A2}", "DisplayVersion")
$aVersions[2][2] = "7.65.17.80"
$aVersions[2][3] = "c:\Program Files\QuickTime\"
$aVersions[2][4] = "Updater Installer Path or whatever"

$aVersions[3][0] = "Adobe Reader - Deutsch"
$aVersions[3][1] = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{AC76BA86-7AD7-1031-7B44-A93000000001}", "DisplayVersion")
$aVersions[3][2] = "9.3.0"
$aVersions[3][3] = "c:\Program Files\ActivIdentity\ActivClient"
$aVersions[3][4] = "Updater Installer Path or whatever"

$aVersions[4][0] = "Flash"
$aVersions[4][1] = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player ActiveX", "DisplayVersion")
$aVersions[4][2] = "10.0.42.34"
$aVersions[4][3] = "C:\WINDOWS\system32\Macromed\Flash"
$aVersions[4][4] = "Updater Installer Path or whatever"

$aVersions[5][0] = "Flash Player Plugin"
$aVersions[5][1] = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player Plugin", "DisplayVersion")
$aVersions[5][2] = "10.0.42.34"
$aVersions[5][3] = "C:\Windows\system32\Macromed\Flash\uninstall_plugin.exe"
$aVersions[5][4] = "Updater Installer Path or whatever"


;=======================================================================
;                           CREATE GUI
;=======================================================================
$GUI = GUICreate("Installed Programs Version Checker & Updater Thingo", 480, 240)
$check_selected = GUICtrlCreateButton("Check Selected", 385, 215, 90, 20)
$check_all = GUICtrlCreateButton("Check All", 300, 215, 80, 20)
$listview = GUICtrlCreateListView("", 5, 5, 470, 205)
_GUICtrlListView_AddColumn($listview, "Program Name", 180)
_GUICtrlListView_AddColumn($listview, "Current Version", 95)
_GUICtrlListView_AddColumn($listview, "Latest Version", 90)
_GUICtrlListView_AddColumn($listview, "Status", 100)

For $i = 0 To UBound($aVersions) - 1
    $x = _GUICtrlListView_AddItem($listview, $aVersions[$i][0])
    _GUICtrlListView_AddSubItem($listview, $x, $aVersions[$i][1], 1)
    _GUICtrlListView_AddSubItem($listview, $x, $aVersions[$i][2], 2)
Next

GUISetState(@SW_SHOW)
;=======================================================================
;                           GUI MESSAGE LOOP
;=======================================================================
While 1
    $nMsg = GUIGetMsg()
    Select
        Case $nMsg = -3
            Exit
        Case $nMsg = $check_selected
            $index = _GUICtrlListView_GetSelectedIndices($listview)
            _CheckVersion($index, $aVersions[$index][0], $aVersions[$index][1], $aVersions[$index][2], $aVersions[$index][3])
        Case $nMsg = $check_all
            For $a = 0 To UBound ($aVersions) - 1
                _CheckVersion($a, $aVersions[$a][0], $aVersions[$a][1], $aVersions[$a][2], $aVersions[$a][3])
            Next
    EndSelect
WEnd

;=======================================================================
;                               FUNCTIONS
;=======================================================================
Func _CheckVersion($i, $name, $current, $latest, $path)
    If Not FileExists($path) Then
        _GUICtrlListView_SetItemText($listview, $i, "Doesn't Exist", 3)
        ;Return 0
    EndIf
    $check = _VersionCompare($current, $latest)
    If $check >= 0 Then
        _GUICtrlListView_SetItemText($listview, $i, "Up to date", 3)
    ElseIf $check = -1 Then
        _GUICtrlListView_SetItemText($listview, $i, "Out of date", 3)
        If $iUPDATE = 1 Then
            _Update($i)
        ElseIf $iUPDATE = 2 Then
            $resp = MsgBox(20, $name & "is not up to date.", $name & " has a newer version available.  Would you like to update?")
            If $resp = 6 Then
                _Update($i)
            EndIf
        EndIf
    Else
        _GUICtrlListView_SetItemText($listview, $i, "Unknown", 3)
    EndIf
EndFunc   ;==>_CheckVersion

Func _Update($i)
    ;Run ($aVersions[$i][4])
    ;_GUICtrlListView_SetItemText($listview, $i, "Up to date", 3)
EndFunc   ;==>_Update

I freely admit - I have no clue what this code really does - but I hope, that you can use the slightly altered keys for your development....

Link to comment
Share on other sites

okay now i found out a little more about the KEYs - by checking with a friend of mine I found out, that the KEYs in the registry themselves do change - a friend of mine has an Adobe reader Version 9.2. versus my 9.3. - her key ends in A92000000001 - mine ends in A93000000001 - so is it useful to check vor registry keys - when some vendors have a policy of changing the keys with every new version? - Can your script deal with this?

Yours Sönke

hey guys,

I am a complete newbie - and found your code development post. Your comes very handy for a little Installer I am building right now. Could i possibly make use of it?

There is another question I have for you - as I found out, the keys I have in my registry differ from your keys, is it due to different language versions? Are the keys changing over time - depending on the Versions I use - for example does Adobe Acrobat Reader 8 - use a different key than Adobe Acrobat Reader 9 ? Are the keys different depending on the Windows Versions? (XP. Vista, 7...) - I'll post your code whith slightly altered keys - which works for my German Windows 7...

;=======================================================================
;                           INCLUDE CONSTANTS
;=======================================================================
#include <GuiListView.au3>
#include <Misc.au3>
;=======================================================================
;                               VARIABLES
;=======================================================================

;1 = Always update, 2 = Ask to update, 3 = never update
$iUPDATE = 1

;=======================================================================
;                       CURRENT VERSION ARRAY
;=======================================================================
Global $aVersions[6][5]

$aVersions[0][0] = "Java"
$aVersions[0][1] = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{26A24AE4-039D-4CA4-87B4-2F83216017FF}", "DisplayVersion")
$aVersions[0][2] = "6.0.170"
$aVersions[0][3] = "C:\Program Files\Java\jre6\bin\java.dll"
$aVersions[0][4] = "Updater Installer Path or whatever"

$aVersions[1][0] = "Adobe Acrobat"
$aVersions[1][1] = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{AC76BA86-1033-F400-7760-000000000004}", "DisplayVersion")
$aVersions[1][2] = "9.3.0"
$aVersions[1][3] = "C:\Program Files\Adobe\Acrobat 9.0\Acrobat"
$aVersions[1][4] = "Updater Installer Path or whatever"

$aVersions[2][0] = "Quick Time"
$aVersions[2][1] = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{1451DE6B-ABE1-4F62-BE9A-B363A17588A2}", "DisplayVersion")
$aVersions[2][2] = "7.65.17.80"
$aVersions[2][3] = "c:\Program Files\QuickTime\"
$aVersions[2][4] = "Updater Installer Path or whatever"

$aVersions[3][0] = "Adobe Reader - Deutsch"
$aVersions[3][1] = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{AC76BA86-7AD7-1031-7B44-A93000000001}", "DisplayVersion")
$aVersions[3][2] = "9.3.0"
$aVersions[3][3] = "c:\Program Files\ActivIdentity\ActivClient"
$aVersions[3][4] = "Updater Installer Path or whatever"

$aVersions[4][0] = "Flash"
$aVersions[4][1] = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player ActiveX", "DisplayVersion")
$aVersions[4][2] = "10.0.42.34"
$aVersions[4][3] = "C:\WINDOWS\system32\Macromed\Flash"
$aVersions[4][4] = "Updater Installer Path or whatever"

$aVersions[5][0] = "Flash Player Plugin"
$aVersions[5][1] = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player Plugin", "DisplayVersion")
$aVersions[5][2] = "10.0.42.34"
$aVersions[5][3] = "C:\Windows\system32\Macromed\Flash\uninstall_plugin.exe"
$aVersions[5][4] = "Updater Installer Path or whatever"


;=======================================================================
;                           CREATE GUI
;=======================================================================
$GUI = GUICreate("Installed Programs Version Checker & Updater Thingo", 480, 240)
$check_selected = GUICtrlCreateButton("Check Selected", 385, 215, 90, 20)
$check_all = GUICtrlCreateButton("Check All", 300, 215, 80, 20)
$listview = GUICtrlCreateListView("", 5, 5, 470, 205)
_GUICtrlListView_AddColumn($listview, "Program Name", 180)
_GUICtrlListView_AddColumn($listview, "Current Version", 95)
_GUICtrlListView_AddColumn($listview, "Latest Version", 90)
_GUICtrlListView_AddColumn($listview, "Status", 100)

For $i = 0 To UBound($aVersions) - 1
    $x = _GUICtrlListView_AddItem($listview, $aVersions[$i][0])
    _GUICtrlListView_AddSubItem($listview, $x, $aVersions[$i][1], 1)
    _GUICtrlListView_AddSubItem($listview, $x, $aVersions[$i][2], 2)
Next

GUISetState(@SW_SHOW)
;=======================================================================
;                           GUI MESSAGE LOOP
;=======================================================================
While 1
    $nMsg = GUIGetMsg()
    Select
        Case $nMsg = -3
            Exit
        Case $nMsg = $check_selected
            $index = _GUICtrlListView_GetSelectedIndices($listview)
            _CheckVersion($index, $aVersions[$index][0], $aVersions[$index][1], $aVersions[$index][2], $aVersions[$index][3])
        Case $nMsg = $check_all
            For $a = 0 To UBound ($aVersions) - 1
                _CheckVersion($a, $aVersions[$a][0], $aVersions[$a][1], $aVersions[$a][2], $aVersions[$a][3])
            Next
    EndSelect
WEnd

;=======================================================================
;                               FUNCTIONS
;=======================================================================
Func _CheckVersion($i, $name, $current, $latest, $path)
    If Not FileExists($path) Then
        _GUICtrlListView_SetItemText($listview, $i, "Doesn't Exist", 3)
        ;Return 0
    EndIf
    $check = _VersionCompare($current, $latest)
    If $check >= 0 Then
        _GUICtrlListView_SetItemText($listview, $i, "Up to date", 3)
    ElseIf $check = -1 Then
        _GUICtrlListView_SetItemText($listview, $i, "Out of date", 3)
        If $iUPDATE = 1 Then
            _Update($i)
        ElseIf $iUPDATE = 2 Then
            $resp = MsgBox(20, $name & "is not up to date.", $name & " has a newer version available.  Would you like to update?")
            If $resp = 6 Then
                _Update($i)
            EndIf
        EndIf
    Else
        _GUICtrlListView_SetItemText($listview, $i, "Unknown", 3)
    EndIf
EndFunc   ;==>_CheckVersion

Func _Update($i)
    ;Run ($aVersions[$i][4])
    ;_GUICtrlListView_SetItemText($listview, $i, "Up to date", 3)
EndFunc   ;==>_Update

I freely admit - I have no clue what this code really does - but I hope, that you can use the slightly altered keys for your development....

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...