Jump to content

ImageSearch Waitforimage

Recommended Posts

hello, i've tried to use _waitforimage using the imagesearch library, but it doesn't seem to work properly for me.

Basically, after a function being done, I want to wait for a button to appear, and when it appears it will proceed.

; Description:      Wait for a specified number of seconds for an image to appear
; Syntax:           _WaitForImageSearch, _WaitForImagesSearch
; Parameter(s):
;                   $waitSecs  - seconds to try and find the image
;                   $findImage - the image to locate on the desktop
;                   $tolerance - 0 for no tolerance (0-255). Needed when colors of
;                                image differ from desktop. e.g GIF
;                   $resultPosition - Set where the returned x,y location of the image is.
;                                     1 for centre of image, 0 for top left of image
;                   $x $y - Return the x and y location of the image
; Return Value(s):  On Success - Returns 1
;                   On Failure - Returns 0
Func _WaitForImageSearch($findImage,$waitSecs,$resultPosition, ByRef $x, ByRef $y,$tolerance,$HBMP=0)


I tried using it like that - 

$temp = _WaitForImageSearch($FindImage,10,1, $tempx, $tempy,0)


it didn't seem to work...

if I stated 10secs to wait, does it mean during the 10sec it will search for the image till it appears and then stop? or it waits 10sec and then give it another try?

thanks :)

I added the ImageSearch files i'm using

(I use PNG's btw, and it works fine with _ImageSearch)



Edited by Rapid

Share this post

Link to post
Share on other sites

During the seconds you pass it will check every 100 miliseconds for the image till 10 secound ends.




Share this post

Link to post
Share on other sites

It's the right way. _WaitForImageSearch searches the image until found or timeout. When found your $Temp = 1, in $TempX and $TempY are the coordinates of the Image.

Edited by AutoBert

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

  • Create New...