Jump to content

detecting a difference between two arrays


Recommended Posts

And even if so, if one insert is done at index 0 in array2, you will get UBound($array) differences whereas only the index changes

 

Not sure what you mean. The purpose of the function is to return the position of the change. By knowing the position of the change I can ten pull it from the array and place it in the database(If you insert a value to position 0 in array 2, it will stop in the first loop and return position 0, the same is true for any point in the either array.). Though your comment made me notice a bug in my code that I revised. [Could not differentiate between no change and change @ position 0]

Edited by nullschritt
Link to comment
Share on other sites

this way is a little faster:

Func _arraygetdifference2($array1, $array2)
    For $i = 0 To UBound($array1) - 1
        If $array1[$i] <> $array2[$i] Then Return $i
    Next
    Return "Null"
EndFunc   ;==>_arraygetdifference2

here a test to compare speed:

Local $a[500000]
Local $b[500000]

For $i = 0 To 499999 ; fill arrays
    $a[$i] = $i
    $b[$i] = $i
Next

$a[499999] = 9 ; last element is not equal

$time = TimerInit()
ConsoleWrite("==> " & _arraygetdifference($a, $b) & @CRLF) ; use func from post #8
ConsoleWrite("Time spent 1: " & TimerDiff($time) & @CRLF)

$time = TimerInit()
ConsoleWrite("==> " & _arraygetdifference2($a, $b) & @CRLF); use my variation
ConsoleWrite("Time spent 2: " & TimerDiff($time) & @CRLF)

Func _arraygetdifference($array1, $array2)
    Local $pos = 'Null'
    For $i = 0 To UBound($array1) - 1
        If $array1[$i] <> $array2[$i] Then
            $pos = $i
            ExitLoop
        EndIf
    Next
    Return $pos
EndFunc   ;==>_arraygetdifference

Func _arraygetdifference2($array1, $array2)
    For $i = 0 To UBound($array1) - 1
        If $array1[$i] <> $array2[$i] Then Return $i
    Next
    Return "Null"
EndFunc   ;==>_arraygetdifference2

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

 

this way is a little faster:

Func _arraygetdifference2($array1, $array2)
    For $i = 0 To UBound($array1) - 1
        If $array1[$i] <> $array2[$i] Then Return $i
    Next
    Return "Null"
EndFunc   ;==>_arraygetdifference2

here a test to compare speed:

Local $a[500000]
Local $b[500000]

For $i = 0 To 499999 ; fill arrays
    $a[$i] = $i
    $b[$i] = $i
Next

$a[499999] = 9 ; last element is not equal

$time = TimerInit()
ConsoleWrite("==> " & _arraygetdifference($a, $b) & @CRLF) ; use func from post #8
ConsoleWrite("Time spent 1: " & TimerDiff($time) & @CRLF)

$time = TimerInit()
ConsoleWrite("==> " & _arraygetdifference2($a, $b) & @CRLF); use my variation
ConsoleWrite("Time spent 2: " & TimerDiff($time) & @CRLF)

Func _arraygetdifference($array1, $array2)
    Local $pos = 'Null'
    For $i = 0 To UBound($array1) - 1
        If $array1[$i] <> $array2[$i] Then
            $pos = $i
            ExitLoop
        EndIf
    Next
    Return $pos
EndFunc   ;==>_arraygetdifference

Func _arraygetdifference2($array1, $array2)
    For $i = 0 To UBound($array1) - 1
        If $array1[$i] <> $array2[$i] Then Return $i
    Next
    Return "Null"
EndFunc   ;==>_arraygetdifference2

Thanks! Nice streamlining.

Link to comment
Share on other sites

Maybe an improvement in the search of differences could be that of splitting the search in two directions within the same loop,
one direction from top to the center and the other direction from bottom to center.
in this way, if differences are located randomly along the array, in the long term, the time to find the difference should reduce to about half.
Of course this works only if is not important to know if the found difference is the first one in the array or the last one.

this should do:

Func _arraygetdifference2($array1, $array2)
    Local $j = UBound($array1)
    For $i = 0 To Int(UBound($array1) - 1)/2
        If $array1[$i] <> $array2[$i] Then Return $i
        $j -=1
        If $array1[$j] <> $array2[$j] Then Return $j
    Next
    Return "Null"
EndFunc   ;==>_arraygetdifference2

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

If speed is critical, don't use 1 line if statements, they go slower than 3 line if statements.

$iTime = TimerInit()
For $i = 0 To 10000000
    If True Then $b = 1
Next
ConsoleWrite(TimerDiff($iTime) & @CRLF)

$iTime = TimerInit()
For $i = 0 To 10000000
    If True Then
        $b = 1
    EndIf
Next
ConsoleWrite(TimerDiff($iTime) & @CRLF)

Output:

6195.61682860482
3975.4707037034

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

 

Maybe an improvement in the search of differences could be that of splitting the search in two directions within the same loop,

one direction from top to the center and the other direction from bottom to center.

in this way, if differences are located randomly along the array, in the long term, the time to find the difference should reduce to about half.

Of course this works only if is not important to know if the found difference is the first one in the array or the last one.

this should do:

Func _arraygetdifference2($array1, $array2)
    Local $j = UBound($array1)
    For $i = 0 To Int(UBound($array1) - 1)/2
        If $array1[$i] <> $array2[$i] Then Return $i
        $j -=1
        If $array1[$j] <> $array2[$j] Then Return $j
    Next
    Return "Null"
EndFunc   ;==>_arraygetdifference2

Seems like a good idea but maybe not always the most efficient. Aka if the string I'm looking for is 1 value past the midpoint, the script will take 2x as long to locate it.

Link to comment
Share on other sites

Minor optimizations on PincoPanco's function is marginally faster:

Func _arraygetdifference4(Const $array1, Const $array2)
  Local Const $up_bound = UBound($array1)
  
  Local Const $up_to = Int(($up_bound - 1) / 2)  
  
  Local $j = $up_bound
  
  For $i = 0 To $up_to Step 1
    If $array1[$i] <> $array2[$i] Then 
      Return $i
    EndIf
    
    $j -= 1
    
    If $array1[$j] <> $array2[$j] Then 
      Return $j
    EndIf
  Next
  
  Return "Null"
EndFunc

Test:

Local $a[500000]
Local $b[500000]

For $i = 0 To 499999 ; fill arrays
  $a[$i] = $i
  $b[$i] = $i
Next

$a[499999] = 9 ; last element is not equal

Global $elapsed = 0

$time = TimerInit()
For $i = 1 To 5
  _arraygetdifference($a, $b)
  $elapsed += TimerDiff($time)
Next
ConsoleWrite("Average 1 " & $elapsed / 5 & @CRLF)
$elapsed = 0

$time = TimerInit()
For $i = 1 To 5
  _arraygetdifference2($a, $b)
  $elapsed += TimerDiff($time)
Next
ConsoleWrite("Average 2 " & $elapsed / 5 & @CRLF)
$elapsed = 0

$time = TimerInit()
For $i = 1 To 5
  _arraygetdifference3($a, $b)
  $elapsed += TimerDiff($time)
Next
ConsoleWrite("Average 3 " & $elapsed / 5 & @CRLF)
$elapsed = 0

$time = TimerInit()
For $i = 1 To 5
  _arraygetdifference4($a, $b)
  $elapsed += TimerDiff($time)
Next
ConsoleWrite("Average 4 " & $elapsed / 5 & @CRLF)

Func _arraygetdifference($array1, $array2)
  Local $pos = 'Null'
  For $i = 0 To UBound($array1) - 1
    If $array1[$i] <> $array2[$i] Then
      $pos = $i
      ExitLoop
    EndIf
  Next
  Return $pos
EndFunc

Func _arraygetdifference2($array1, $array2)
  For $i = 0 To UBound($array1) - 1
    If $array1[$i] <> $array2[$i] Then Return $i
  Next
  Return "Null"
EndFunc

Func _arraygetdifference3($array1, $array2)
  Local $j = UBound($array1)
  For $i = 0 To Int(UBound($array1) - 1)/2
    If $array1[$i] <> $array2[$i] Then Return $i
    $j -=1
    If $array1[$j] <> $array2[$j] Then Return $j
  Next
  Return "Null"
EndFunc

Func _arraygetdifference4(Const $array1, Const $array2)
  Local Const $up_bound = UBound($array1)
  
  Local Const $up_to = Int(($up_bound - 1) / 2)  
  
  Local $j = $up_bound
  
  For $i = 0 To $up_to Step 1
    If $array1[$i] <> $array2[$i] Then 
      Return $i
    EndIf
    
    $j -= 1
    
    If $array1[$j] <> $array2[$j] Then 
      Return $j
    EndIf
  Next
  
  Return "Null"
EndFunc
Link to comment
Share on other sites

Has anyone suggested using Scripting.Dictionary to compare?

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Seems like a good idea but maybe not always the most efficient. Aka if the string I'm looking for is 1 value past the midpoint, the script will take 2x as long to locate it.

 

You are right, I was wrong, in the long term there is not advantage.

If speed is critical, don't use 1 line if statements, they go slower than 3 line if statements.

$iTime = TimerInit()
For $i = 0 To 10000000
    If True Then $b = 1
Next
ConsoleWrite(TimerDiff($iTime) & @CRLF)

$iTime = TimerInit()
For $i = 0 To 10000000
    If True Then
        $b = 1
    EndIf
Next
ConsoleWrite(TimerDiff($iTime) & @CRLF)

Output:

6195.61682860482

3975.4707037034

 

this seems interesting,

but having tried jaberwacky's test in post >#29, the func that use this suggestions takes longer time than the one that uses "1 line if statement"

to make the test I changed

$a[499999] = 9  --> to $a[250000] = 9

so the difference is in the middle of the array.

this is the result:

Average 1 596.088079322401

Average 2 485.371194972564

Average 3 1106.30611673769 <--- "1 line if statement"

Average 4 1280.84799019452 <--- "3 line if statement"

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

how can this achieved?

Read the first array into a Scripting.Dictionary object and then use .Exists to check if it's already present when iterating through the second array.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

how can this achieved?

An idea ...

Example()

Func Example()
    Local $aArray_1 = __ArrayFill(1, False) ; Create a 1d random zeroth element array.
    Local $aArray_2 = __ArrayFill(1, False) ; Create a 1d random zeroth element array.

    Local $hAssocArray = 0
    _AssociativeArray_Startup($hAssocArray)

    #Region Check $aArray_1
    For $i = 0 To UBound($aArray_1) - 1
        $hAssocArray.Item($aArray_1[$i]) = 0 ; Add to the associative array.
    Next

    For $i = 0 To UBound($aArray_2) - 1
        If Not $hAssocArray.Exists($aArray_2[$i]) Then ; Check if the item exists.
            ConsoleWrite($aArray_2[$i] & ' >> doesn''t exist in $aArray_2' & @CRLF)
        EndIf
    Next
    #EndRegion Check $aArray_1

    $hAssocArray = 0 ; Destroy the object.
    _AssociativeArray_Startup($hAssocArray)

    #Region Check $aArray_2
    For $i = 0 To UBound($aArray_2) - 1
        $hAssocArray.Item($aArray_2[$i]) = 0 ; Add to the associative array.
    Next

    For $i = 0 To UBound($aArray_1) - 1
        If Not $hAssocArray.Exists($aArray_1[$i]) Then ; Check if the item exists.
            ConsoleWrite($aArray_1[$i] & ' >> doesn''t exist in $aArray_1' & @CRLF)
        EndIf
    Next
    #EndRegion Check $aArray_2

EndFunc   ;==>Example

Func _AssociativeArray_Startup(ByRef $aArray, $fIsCaseSensitive = False) ; Idea from MilesAhead.
    Local $fReturn = False
    $aArray = ObjCreate('Scripting.Dictionary')
    ObjEvent('AutoIt.Error', '__AssociativeArray_Error')
    If IsObj($aArray) Then
        $aArray.CompareMode = Int(Not $fIsCaseSensitive)
        $fReturn = True
    EndIf
    Return $fReturn
EndFunc   ;==>_AssociativeArray_Startup

Func __ArrayFill($iType, $fIsIndexCount = Default) ; By guinness.
    Local $iRows = Random(2, 1000, 1)
    If $fIsIndexCount = Default Then
        $fIsIndexCount = True
    EndIf
    Switch $iType
        Case 2
            Local $iCols = Random(2, 25, 1)
            Local $aReturn[$iRows][$iCols]
            For $i = 0 To $iRows - 1
                For $j = 0 To $iCols - 1
                    $aReturn[$i][$j] = 'Row ' & $i & ': Col ' & $j
                Next
            Next
            If $fIsIndexCount Then
                For $i = 0 To $iCols - 1
                    $aReturn[0][$i] = ''
                Next
                $aReturn[0][0] = $iRows - 1
            EndIf
        Case Else
            Local $aReturn[$iRows]
            For $i = 0 To $iRows - 1
                $aReturn[$i] = 'Row ' & $i
            Next
            If $fIsIndexCount Then
                $aReturn[0] = $iRows - 1
            EndIf
    EndSwitch
    Return $aReturn
EndFunc   ;==>__ArrayFill

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

 

An idea ...

 

nice! learned something new

can be useful to use his ready made methods.

but this script does not find if the 2 arrays are identical

also, looking at this page I am not able to find a method or an easy way to compare if 2 arrays are identical and if not, where is the (first) difference...

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

What if you somehow integrated the below code, It would help compare differences in a simpler manner without looping through all the arrays. Whether or not it's quicker I'll leave that up to you guys to figure out. Along with how to determine the array position of change.

While 1
$CombinedNewData = _ArrayToString($Array, " ", 1, $Array[0])
$CombinedOldData = _ArrayToString($Array2, " ", 1, $Array2[0])  

If $CombinedNewData <> $CombinedOldData Then
   MsgBox(0, "", "Something Changed")
   ;Call your function to determine position?
ElseIf $CombinedNewData = $CombinedOldData Then
   MsgBox(0. "", "Nothing Changed")
   ;Continue While Loop
EndIf

Sleep("60000")

WEnd
Edited by BlackDawn187
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...