aa2zz6 Posted July 1, 2015 Share Posted July 1, 2015 (edited) How do I nest multiple PixelSearch like the code below so if one fails they both do? Thanks again for any help.$coord = PixelSearch( 24, 85, 1238, 916,0xF6D370,1)If Not @error Then MouseMove($coord[0],$coord[1],0)Sleep(500)MouseClick("left")sleep(5000)EndIf Edited July 1, 2015 by aa2zz6 Link to comment Share on other sites More sharing options...
water Posted July 1, 2015 Share Posted July 1, 2015 Welcome to AutoIt and the forum!Which program do you try to automate?Most of the time there are more reliable ways to do what you want to achieve by using other AutoIt functions. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
aa2zz6 Posted July 1, 2015 Author Share Posted July 1, 2015 The idea was to create a short application that searches for a certain pixel on Google Earth and if that particular pixel wasn't found then it would set a random movement. I work a lot with Google Earth in real-life and I thought it would be neat to show my co-workers something different. : ) The idea is to find the pixel and if it's not found then we use a MouseClickDrag(), but when the pixel is found the MouseClickDrag keeps on going. What would be the best way to handle a situation like this. Maybe split these the code into two different functions Func(GooglePixel) And Func(MoveMouse) and if the pixel is not found then the GooglePixel would somehow tell the Func(MoveMouse) to move either Down to the Right depending on how the coordinates are set.$i = 0While $i <= 10 MouseClickDrag("left", 689, 501, 686, 206) Sleep(1000) $coord = PixelSearch(24, 85, 1238, 916,0xA8B679,2) If Not @error Then MouseClick("primary", $coord[0], $coord[1], 1, 0) EndIf $i = $i + 1 Sleep(2000)WEnd Link to comment Share on other sites More sharing options...
JohnOne Posted July 1, 2015 Share Posted July 1, 2015 (edited) Array full of coordinates.Loop through array With a For...Next loop, Calling PixelSearch with each set of coordinates from the array, if one sets @error then return false, no point in checking the rest, return true if loop ends. Edited July 1, 2015 by JohnOne aa2zz6 1 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
aa2zz6 Posted July 5, 2015 Author Share Posted July 5, 2015 Thanks for the help and responses! 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