Sign in to follow this  
Followers 0
SamueleColombo

Multiple - Image Loop Research

4 posts in this topic

Goodmorning,

First of all I'm sorry for my little english, I hope that you'll undestand.

I'm writing a script that finds 20 images from the screen using the library ImageSeach

When It finds an image, the program launch a subroutine that search an other one image that has a particular relation with the previuos one.

This procedure has to loop until I'll use an hotkey.

#include <ImageSearch.au3>
#include <GDIPlus.au3>

_GDIPlus_Startup()

Dim $ansArray[10]
Dim $qstArray[10]
Dim $ansResult[10]
Dim $qstResult[10]

Global $i
Global $loop

HotKeySet("^!x", "MyExit")

For $i = 0 To 9
$ansArray[$i] = _GDIPlus_BitmapCreateHBITMAPFromBitmap(_GDIPlus_ImageLoadFromFile(@ScriptDir & "\" & $i & "a.png"))
$qstArray[$i] = _GDIPlus_BitmapCreateHBITMAPFromBitmap(_GDIPlus_ImageLoadFromFile(@ScriptDir & "\" & $i & ".png"))
Next

While 1
Local $x = 0
Local $y = 0

For $loop = 0 To 2
For $i = 0 To 9
$qstResult[$i] = _ImageSearch($qstArray[$i], 1, $x, $y, 20)
ConsoleWrite("Result" & $qstResult[$i] & @CRLF)
If $qstResult[$i] = 1 Then
$ansResult[$i] = _ImageSearch($ansArray[$i], 1, $x, $y, 20)
If $ansResult[$i] = 1 Then
;Operation
EndIf
EndIf
Next

Next
WEnd

Func MyExit()
Exit
EndFunc

It finds only the first image that matches with the choosen one but, after, it loops without using ImageSearch...why?

I have to refresh or destroy my previuos results?

Thank you very much!

Share this post


Link to post
Share on other sites



The application you are working with - does it have controls you can interact with automation or is the entire app based on something like a screen showing for example various cards from a deck of cards or a set of flash cards? If it has controls such as buttons then have you tried to hook into the controls for those instead?

Share this post


Link to post
Share on other sites

It's working on flash player application. I think to search the images because this application runs on different type of computers and I need more portablity.

Do you know why _imagesearch works only one time even if I use infinity loop?

Thanks!

Share this post


Link to post
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
Sign in to follow this  
Followers 0