So I've been building a tool to help identify a series of numbers, ex. 21,192, then be able to sort the numbers found based off of the X coordinate from left to right, but I am having issues trying to output the desired end result being "21192". In this case I am receiving "COORDX2 COORDX1 COORDX1 COORDX9 ... etc"
I cannot seem to wrap my head around what I am doing incorrectly and I know 100% that there is probably a better way to do things, but I don't have a huge programming background to know what formula I should be using. I know my issues are after the initial sorting of numbers from left to right. I just cannot seem to arrange the numbers in the desired result I would like to be, in this case "21192". Below the code I'll list other things that I've tried but I couldn't seem to get the desired result correctly.
I know there are probably 50 ways to do this, but in my head and whatever I could learn from other posts this is the best and what made sense to me. You're more than welcome to break it up in a way that makes it work properly but if you don't mind explaining ♥ELI5♥ some of the stuff you'll be doing so I can walk away with some knowledge on this would be very appreciative. Thank you
Code: Select all
COLUMN1()
{
NumWord := ["num0", "img1", "img2", "img3", "img4", "img5", "img6", "img7", "img8", "img9"]
GrandTotal := "", FoundX := "" ;; Reset and Stores Variables
Left = 1845
loop, 10
{
SEARCHAGAIN:
ImageSearch, FoundX,, %Left% , 505, 1950, 529, % "*170 *transwhite " . a_scriptdir . "\LA\num1\" . NumWord[A_Index] . ".png"
if !ErrorLevel ;; Image found
{
GrandTotal .= FoundX . A_Index - 1 . A_Tab
Left := FoundX + 5
goto SEARCHAGAIN
}
}
Sort, GrandTotal, N DA_TAB ;; Sorts by FoundX L-->R
GrandTotal.RemoveAt(A_Index, -1) ;; Removes FoundX
GrandTotal.RemoveAt(A_Index, +1) ;; Removes A_Tab
msgbox % GrandTotal . " is the total"
}
Code: Select all
GrandTotal.RemoveAt(1) ;; Removes FoundX
GrandTotal.RemoveAt(3) ;; Removes A_Tab
msgbox % GrandTotal.RemoveAt(1) . " is the total"
msgbox % GrandTotal[2]