Bettylou Posted April 25, 2017 Author Share Posted April 25, 2017 (edited) 6 hours ago, Subz said: Yes sorry missed that: If $bRegInstall = False Then FileWrite($hFileOpen,$aAppList[$i][0] & " is not installed." & @CRLF) hey man you owe me no apologies. I am just so grateful for all your invaluable help. I gave it a test run. CCleaner is out of date - hitmanpro is not installed - firefox is up to date As you can see the uninstalled "hitmanpro" is not printing out but that is not a deal breaker expandcollapse popup#include <Array.au3> #include <Misc.au3> Local $bRegInstall = False Local $aRegItem[0][2] Local $aRegInfo[0][2] Local $sRegUninstall32 = "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\" Local $sRegUninstall64 = "HKLM64\Software\Microsoft\Windows\CurrentVersion\Uninstall\" Local $aAppList = [["CCleaner", "5.5"], ["HitmanPro", "5.7"], ["Mozilla Firefox", "53"]] $hFileOpen = FileOpen(@ScriptDir & "\AppInfo.txt", 1) For $i = 0 To UBound($aAppList) - 1 _RegSearch($sRegUninstall64, $aAppList[$i][0], $aAppList[$i][1]) _RegSearch($sRegUninstall64, $aAppList[$i][0], $aAppList[$i][1]) If $bRegInstall = False Then FileWrite($hFileOpen,$aAppList[$i][0] & " is not installed." & @CRLF) Next FileClose($hFileOpen) Func _RegSearch($sRegHive, $sDisplayName, $sDisplayVersion) Local $i = 1, $sRegKey While 1 $sRegKey = RegEnumKey($sRegHive, $i) If @error Then ExitLoop $RegDisplayName = RegRead($sRegHive & $sRegKey, "DisplayName") If $RegDisplayName <> "" Then _ArrayAdd($aRegInfo, $RegDisplayName & "|" & RegRead($sRegHive & $sRegKey, "DisplayVersion")) If StringInStr($RegDisplayName, $sDisplayName) Then $bRegInstall = True _ArrayAdd($aRegItem, $RegDisplayName & "|" & RegRead($sRegHive & $sRegKey, "DisplayVersion")) $RegVersion = RegRead($sRegHive & $sRegKey, "DisplayVersion") Switch _VersionCompare($RegVersion, $sDisplayVersion) Case 0 FileWrite($hFileOpen, $sDisplayName & " " & $sDisplayVersion & " is up-to-date." & @CRLF) Case 1 FileWrite($hFileOpen, "You have a later version for " & $sDisplayName & "/" & $sDisplayVersion & "==> " & $RegDisplayName & "/" & $RegVersion & @CRLF) Case -1 FileWrite($hFileOpen, "You have an older version for " & $sDisplayName & "/" & $sDisplayVersion & "==> " & $RegDisplayName & "/" & $RegVersion & @CRLF) EndSwitch EndIf $i += 1 WEnd EndFunc ;==>_RegSearch I've just had a thought (it happens occasionally lol) --- How about - create 2 arrays and use array search to find all the dupes. array1 = the list generated by your script array2 = $aAppsList I've been experimenting. array display works but array search doesn't #include <Array.au3> #include <MsgBoxConstants.au3> Local $found Local $Array1 = [["CCleaner", "5.5"], ["HitmanPro", "5.7"], ["Mozilla Firefox", "53"], ["Java", "8 Update 131"]] ;_arraydisplay($Array1) Local $Array2 = [["CCleaner", "5.5"], ["Defraggler", "2.21"], ["HitmanPro", "3.7"]] ;_arraydisplay($Array2) For $i = 0 To UBound($Array1)-1 $found = _ArraySearch($Array2, $Array1[$i]) msgbox(0, "", $found & @CRLF) next Edited April 25, 2017 by Bettylou Link to comment Share on other sites More sharing options...
Bettylou Posted April 29, 2017 Author Share Posted April 29, 2017 UPDATE! Program has been running on all computers since Tuesday without any problems. many thanks for all the invaluable help. Link to comment Share on other sites More sharing options...
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