Jump to content
Sign in to follow this  
q23456789

Image search wait for image(?)

Recommended Posts

q23456789

Basicly what I'm trying to do is make the image search wait for the image, instead of if it doesn't find it it goes to the next line.

Here is the script I'm using.

_____________________________________

#include <ImageSearch.au3>

While 1

$x3=0

$y3=0

$x2=0

$y2=0

$x1=0

$y1=0

$x4=0

$y4=0

$x5=0

$y5=0

$result3 = _ImageSearch("picture1.png",1,$x3,$y3,80)

If $result3 = 1 Then

MouseClick("left",$x3,$y3,3)

sleep (100)

endif

$result3 = _ImageSearch("picture2.png",1,$x3,$y3,80)

If $result3 = 1 Then

MouseClick("left",$x3,$y3,3)

endif

wend

_______________________________________________

Basicly, I need a line to make "$result3 = ..." wait for the image, but instead it just moves on to the next image search.

Thanks alot to whoever helps. And yes.. I am fairly new to Autoit..

Edited by q23456789

Share this post


Link to post
Share on other sites
water

Welcome to AutoIt and this forum!

Do the _ImageSearch in a loop. Exit the loop if the returncode of _ImageSearch denotes that the image was found.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
q23456789

Welcome to AutoIt and this forum!

Do the _ImageSearch in a loop. Exit the loop if the returncode of _ImageSearch denotes that the image was found.

Thanks for the quick response. But, honestly, I don't know what the command line would be to create a loop.. I guess I'm just that new. Are you saying something like create a "while 1>image search 1 >wend while 2>image search 2>wend 2"?

Share this post


Link to post
Share on other sites
water

Something like this:

Do
    $iResult = _ImageSearch("picture1.png",1,$x3,$y3,80)
    If $iResult <> 1 Then Sleep(1000) 
Until $iResult = 1

If $iResult = 1 (Image is found) then the loop will be exited. Else the script waits for a second and then tests again.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
q23456789

Something like this:

Do
    $iResult = _ImageSearch("picture1.png",1,$x3,$y3,80)
    If $iResult <> 1 Then Sleep(1000) 
Until $iResult = 1

If $iResult = 1 (Image is found) then the loop will be exited. Else the script waits for a second and then tests again.

Great, thanks alot. I'll try this out and hope it works.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.