Quantcast
Viewing latest article 3
Browse Latest Browse All 12506

Infinite Loop For Next when Deleting Array Elements

Good Morning AutoIT Gurus and Masters Image may be NSFW.
Clik here to view.
:sorcerer:

 

Slightly complicated array here... and infinite loop that I'm trying to output to a file after the values are matched up; then anything that doesn't match is deleted from the array and finally written to a file...

 

This guy does an infinite loop... and I'm not sure why... I tried to put in message boxes - but there are 20K records so I couldn't click through that many. LOL.

AutoIt         
#RequireAdmin #include <array.au3> #include <file.au3> #include <Excel.au3> #include <MsgBoxConstants.au3> Global $WXYZArray01, $array01, $ProgramTitle, $sleeptime, $k01 $ProgramTitle = "Testing 1 2 3" $sleeptime = 1000 _FileReadToArray(@ScriptDir & "\" & "testing_output_csv_unique_values.csv", $array01, "", ",") ;_ArrayDisplay ($array01, "Array01") $aUniqueHostname = _ArrayUnique ($array01, 1) ;_ArrayDisplay ($aUniqueHostname, "UniqueHostname ") For $i01 = Ubound($aUniqueHostname) - 1 to 0 Step - 1     For $j01 = Ubound($array01) - 1 to 0 Step - 1         If $array01[$j01][1] == $aUniqueHostname[$i01] and StringRegExp($array01[$j01][5], "MY_VALUE") then             MsgBox(0, "Computer and MY_VALUE",  $aUniqueHostname[$i01] & " : " & $array01[$j01][5])             $FileName01 = @ScriptDir & "\" & $array01[$j01][3] & "_" & $aUniqueHostname[$i01] & "_" & $array01[$j01][2] & ".csv"              MsgBox(0, "File Name", $FileName01)                 $WXYZArray01 = $array01                 _ArrayDisplay ($WXYZArray01, "WXYZ Array")                 SplashTextOn($ProgramTitle, 'Generic - Please wait for loop to complete...', 400, 40, -1, -1, 2, "", 10)                 Sleep ($sleeptime)                 For $k01 = 0 To Ubound($WXYZArray01) - 1                     ; MsgBox (0, "In the WXYZ loop", $WXYZArray01[$k01][1] & " : " & $aUniqueHostname[$i01])                     If $WXYZArray01[$k01][1] <> $aUniqueHostname[$i01] Then                         ;MsgBox (0, "In the WXYZ loop - Delete", $WXYZArray01[$k01][1] & " : " & $aUniqueHostname[$i01])                     _ArrayDelete($WXYZArray01, $k01)                     ;_ArrayDisplay ($WXYZArray01)                     $k01 -= 1                     EndIf                     If $k01 = UBound($WXYZArray01) - 1 Then ExitLoop                 Next                 SplashOff()                 MsgBox (0, "Out of the WXYZ loop", "Out of the WXYZ loop - File Write From Array")                 _FileWriteFromArray($FileName01, $WXYZArray01, 1)             ExitLoop         EndIf     Next Next

I'm hoping someone here can tell me why at a glance... I'm a little burned out to see the answer... feeling toasty Image may be NSFW.
Clik here to view.
:)
LOL  Image may be NSFW.
Clik here to view.
:idea:

Thank you everyone for your help!

 

Image may be NSFW.
Clik here to view.
:thumbsup:

 

 


Viewing latest article 3
Browse Latest Browse All 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>