Sign in to follow this  
Followers 0
Adergon

Wait for Imagesearch

9 posts in this topic

Hey All!

I have this function imagesearch here.

Do
    $result = _ImageSearch("picture1.png",1,$x1,$y1,15)
    If $result= 1 Then MouseClick("Left", $x1, $y1, 1)
If $result= 0 Then Sleep(2000)
Until $result = 1

This code actually do work, but i would like to change it a little.:)

How edit the function, so it moves on to the next function after X amount on seconds? becuase i don't want it to sit still there and just wait for the image. i want it to move on to the next function if it doesnt find it.

reason why i make it wait for the image, is because i want it to click as soon as the picture pops up.

THANKU

Share this post


Link to post
Share on other sites



If you want it to get out of that loop if the image is not found, then simply remove the loop.

I'm not so good with AutoIt, could you please post an example?

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

$result = _ImageSearch("picture1.png",1,$x1,$y1,15)
    If $result= 1 Then MouseClick("Left", $x1, $y1, 1)
If $result= 0 Then Sleep(2000)

Does that function wait for the image? becuase isn't this:

Until $result = 1

Needed?

EDIT: I want the function to wait for the image for 10 seconds. otherwise it moves on. sorry, was a bit unclear

Edited by Adergon

Share this post


Link to post
Share on other sites

You want a timer. Open helpfile and read about TimerInit() and ExitLoop.

I read trough it, and i see the idea. i set the timerinit for 10 seconds, and then it exits the function right? but i dont seem to get this work with the imagesearch. could you or someone add it to the code? then it will be easier for me to understand. Since im new to this. Sorry.

Share this post


Link to post
Share on other sites

Bump!

Share this post


Link to post
Share on other sites

That's not the way of things here.

Post your code, and if someone can help you with it they will.

You can just keep asking for someone to do it for you and it might work

and it's your time to waste, but if you show your willing and effort, that time will

pass much quicker.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

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