I've iterated the script to include labels so I can loop through until a certain image is found:
Wait>3
Label>Start
Let>NumFound1=0
FindImagePos>c:\test\end2.bmp,SCREEN,0,1,Xpos,YPos,NumFound1
If>NumFound1>0
Goto>Exit
Else
Goto>Checker_1
Endif
Label>Checker_1
FindImagePos>c:\test\win.bmp,SCREEN,0,1,Xpos,YPos,NumFound2
If>NumFound2>0
WriteLn>c:\test\results.txt,%YPos_0%,%XPos_0%
Wait>0.25
Else
Goto>Checker_2
Endif
Label>Checker_2
FindImagePos>c:\test\bmp\Jim.bmp,SCREEN,0,1,Xpos,YPos,NumFound3
If>NumFound3>0
WriteLn>c:\test\results.txt, %NumFound3%, P1 is Jim
Wait>0.25
Goto>Checker_3
Else
Goto>Checker_3
Endif
Label>Checker_3
FindImagePos>c:\test\bmp\Joe.bmp,SCREEN,0,1,Xpos,YPos,NumFound4
If>NumFound4>0
WriteLn>c:\test\results.txt, %NumFound4%, P2 is Joe
Wait>0.25
Else
Goto>Start
Endif
Label>Exit
WriteLn>c:\test\results.txt, %NumFound5%, File ended
Also the scope has been extended to attempt to handle multiple images that are "seen" however it's quite unstable like this.
The code is running sequentially and there's event some overlap in terms of when images appear on screen. That is to say that there may be cases where I miss logging an event because I use wait periods in order not to write many duplicate lines in the text file.
Is it possible to have any number amount of loops fire and run independently of each other in their own "threads" or suchlike so that their wait periods, etc are not affected by each other?
Also, is there a better / more elegant way to check for multiple images than my structure above? I have in fact around 40 images that I need to check for and I think it'll become problematic if I can't handle the comparison part efficiently. I think I need something like an OR operator with FindImagePos like fine img1.bmp or img2.bmp or img3.bmp, etc. Is something like that possible?
Many thanks.