Just wanted to ask if the 1st post could be updated to reflect the current state of the function, having to read the whole thread is cumbersome.
And would like a better built in array for the current output of found images as described below.
FOR SINGLE IMAGE DETECTION PER CYCLE
Code: Select all
Image := "|<SINGLE_PIC_NAME>*76"
Pic(Image,1) ; <--- This function is posted in this thread not going to add it's redundant.
If (ok:=FindText(0, 35, 1200, 60, 0, 0, Image) <--- Without the use of the Pic() Function.
If (ok:=FindText(0, 35, 1200, 60, 0, 0, this.Pic("SINGLE_PIC_NAME")))
{
TrayTip , FindText Function, Found, 5, 16 ; <--- Personally don't use MSGBOX when not needed, it traps the code.
} Else {
TrayTip , FindText Function, No Image Found, 5, 16
}
FOR MULTI IMAGE DETECTION PER CYCLE
Code: Select all
Image :="|<MULTI_PIC_NAME1>*76"
Image .="|<MULTI_PIC_NAME2>*76"
Image .="|<MULTI_PIC_NAME3>*76"
Image .="|<MULTI_PIC_NAME4>*76"
Pic(Image,1) <---- Can be added as a single dump or
static ID := 0
List := {}
INIREAD, INIList, FILEname
Loop, parse, INIList, 'n
{
ID++
INIREAD, IDvar, FILEname, %A_loopField%, ID
INIREAD, IMAGEvar, FILEname, %A_loopField%, IMAGE
Pic(IMAGEvar,1)
params := {Name:A_loopField, ID:IDvar, Image:IMAGEvar, X:X, Y:Y, W:W, XW:XW, YH:YH}
this.List[this.ID] := params
}
;ONLY ONE OPTION ABOVE IS REQUIRED JUST SHOWING DIFFERENT METHODS.
If (FOUND := FindText(0, 35, 1200, 60, 0, 0, this.Pic("MULTI_PIC_NAME1|MULTI_PIC_NAME2|MULTI_PIC_NAME3|MULTI_PIC_NAME4")))
{
;THIS IS WERE ID LIKE THE CORE CODE TO BE UPDATED TO A BETTER ASSOCIATED ARRAY AS SHOWN ABOVE IN THE INIREAD LOOP
;OLD ok.1+#1-5
;CURRENT ok.1.#1-5
Loop, % FOUND.MaxIndex() ; IF COMPARING FOUND ARRAY TO LIST ARRAY USE A_Index-1 cause arrays start at 0 and Loops default to 1
{
FOUND[A_Index].ID ; This is "Comment" as seen in the current code.
FOUND[A_Index].X
FOUND[A_Index].Y
FOUND[A_Index].W
FOUND[A_Index].H
FOUND[A_Index].XW := FOUND[A_Index].X+=FOUND[A_Index].W//2
FOUND[A_Index].YH := FOUND[A_Index].Y+=FOUND[A_Index].H//2
;ABOVE IS JUST BROKEN OUT TO SHOW THE OUTPUTS OF THE "FOUND" ARRAY IF CORE CODE WAS REWRITTEN.
TrayTip , FindText Function, % FOUND[A_Index].ID, 5, 16
If FOUND[A_Index].ID == "MULTI_PIC_NAME1"
{
;DO SOMETHING IF IMAGE 1 IS FOUND
} Etc.
;OR USED MORE DYNAMICALLY
Parent := A_Index
Loop, % List.MaxIndex()
{
If (List[A_Index-1].ID == FOUND[Parent].ID)
{
}
}
}
} Else {
TrayTip , FindText Function, No Image Found, 5, 16
}