The basic premise is this. Call _ArrayCompare() with two one-dimensional arrays $aLeft and $aRight. It works best if they're at least similar. The return is an array of arrays which has two elements. The first element is the script for $aLeft and the second element is the script for $aRight. The scripts themselves are arrays with the same dimensions as the original arguments but with a zero or one in each entry to indicate whether the array entry at that point is unchanged (zero) or changed (one). By processing these scripts intelligently you can determine whether entries have been deleted/changed/inserted as appropriate.
Of course, I realise as I'm typing this that it all sounds rather complex. However, it should be straightforward so I'll try to explain a scenario:
Global $aLeft[9] = ["The", "big", "black", "cat", "sat", "on", "the", "mat", "again."] Global $aRight[8] = ["The", "dog", "sat", "on", "the", "white", "cat", "ouch!"] Glboal $aRet = _ArrayCompare($aLeft, $aRight)
From this code you should get:
$aRet[0] = [0, 1, 1, 1, 0, 0, 0, 1, 1] $aRet[1] = [0, 1, 0, 0, 0, 1, 1, 1]
The zeroes show where the two arrays "line up" which is on ["The"] (element zero) and ["sat", "on", "the"] (elements 4-6 in $aLeft and 2-4 in $aRight).
I hope someone finds this useful in some way. My code is based on the diff algorithm from GNU but is much simplified for AutoIt implementation. The code can be found HERE.
As always, have fun.
WBD
Edited by WideBoyDixon, 20 May 2009 - 03:20 PM.






