g0ne Posted July 21, 2012 Share Posted July 21, 2012 I'm rather new to Autoit and I'm attempting to create a script that will find an image and click it until that image can no longer be found, then go to the next image and click that image until it's not found. I think i've tried every solution I can think of and I couldn't find anything in forum search that would work. Here's the current script that simply finds image1, clicks it, finds image2, clicks it. $image1 = _ImageSearchArea("image1.bmp",1,$ulsearch[0],$ulsearch[1],$lrsearch[0],$lrsearch[1],$x1,$y1,50) If $image=1 Then MouseMove($x1, $y1, 20) MouseClick("left") sleep(50) $image1=0 EndIf $image2 = _ImageSearchArea("image2.bmp",1,$ulsearch[0],$ulsearch[1],$lrsearch[0],$lrsearch[1],$x1,$y1,50) If $image2=1 Then MouseMove($x1, $y1, 20) MouseClick("left") sleep(50) $image2=0 EndIf Link to comment Share on other sites More sharing options...
PhoenixXL Posted July 21, 2012 Share Posted July 21, 2012 So what is the problem, I cant get it since the full code isnt provided My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted July 21, 2012 Moderators Share Posted July 21, 2012 Hi, gOne, welcome to the forum. Your script is doing exactly what you tell it to, as you have a single If statement. Look at While...WEnd in the help file. I don't do much with ImageSearch, but something like: $image1 = _ImageSearchArea("image1.bmp",1,$ulsearch[0],$ulsearch[1],$lrsearch[0],$lrsearch[1],$x1,$y1,50) While $image=1 MouseMove($x1, $y1, 20) MouseClick("left") sleep(50) WEnd ...should work better for you. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
water Posted July 21, 2012 Share Posted July 21, 2012 Just out of curiosity: What kind of application needs to click on different images until they are gone? 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...
somdcomputerguy Posted July 21, 2012 Share Posted July 21, 2012 While $image=1 should be While $image1=1, no? - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted July 22, 2012 Moderators Share Posted July 22, 2012 Yes, typo on my part. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
somdcomputerguy Posted July 22, 2012 Share Posted July 22, 2012 Actually, a typo on the OP's part. You did start to viralize it though, probably by copying/pasting the original code snippet in order to modify/correct it.. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. 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