q23456789 Posted April 28, 2011 Share Posted April 28, 2011 (edited) 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 April 28, 2011 by q23456789 Link to comment Share on other sites More sharing options...
water Posted April 28, 2011 Share Posted April 28, 2011 (edited) 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 April 28, 2011 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
q23456789 Posted April 28, 2011 Author Share Posted April 28, 2011 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"? Link to comment Share on other sites More sharing options...
water Posted April 28, 2011 Share Posted April 28, 2011 (edited) 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 April 28, 2011 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
q23456789 Posted April 28, 2011 Author Share Posted April 28, 2011 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now