bosk20 Posted December 5, 2015 Share Posted December 5, 2015 (edited) Hi, i wgot problem with send key when script found pixel.$pixel = PixelSearch(448, 250, 458, 550, 16775664, 0, 1) If NOT @error Then ControlSend($win, "", "", "{LEFT}");30 repeat? EndIf $pixel = PixelSearch(574, 245, 583, 548, 16775664, 0, 1) If NOT @error Then ControlSend($win, "", "", "{RIGHT}");30 repeat? EndIfHow to send key for expamle 30 times then stop it? Edited December 5, 2015 by bosk20 Link to comment Share on other sites More sharing options...
JohnOne Posted December 6, 2015 Share Posted December 6, 2015 {LEFT 30} 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...
bosk20 Posted December 6, 2015 Author Share Posted December 6, 2015 Does not work, I tried earlier. I put in in while but i try to set after 30 repeats this function enable break and run another but nothing work. HotKeySet("{up}", "start") func start() while 1 ;hot to repeat 30 times this comends? $pixel = PixelSearch(425, 413, 481, 463, 14655792, 0, 1) If NOT @error Then ControlSend($win, "", "", "{LEFT}") EndIf $pixel = PixelSearch(425, 518, 481, 567, 14655792, 0, 1) If NOT @error Then ControlSend($win, "", "", "{RIGHT}") EndIf wend ;break() EndFunc func break() while 1 sleep(100) wend endfuncIts random send key but how to do that for send 30 times in one function?any sugestion? Link to comment Share on other sites More sharing options...
Developers Jos Posted December 6, 2015 Developers Share Posted December 6, 2015 Does not work, I tried earlier. I put in in while but i try to set after 30 repeats this function enable break and run another but nothing work.-snip-Its random send key but how to do that for send 30 times in one function?any sugestion?You got the solution, so what exactly did you do that didn't work?Maybe also give a much better description of what you are trying to do so we can actually try and help. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
bosk20 Posted December 6, 2015 Author Share Posted December 6, 2015 When i try do it with {left 30} script dont work. I don't know how to set the condition that after a given amount ControlSend(left and right) script will perform another action? Link to comment Share on other sites More sharing options...
Timppa Posted December 7, 2015 Share Posted December 7, 2015 You can also use for loop: Func start() While 1 $pixel = PixelSearch(425, 413, 481, 463, 14655792, 0, 1) If NOT @error Then For $i = 0 To 30 ControlSend($win, "", "", "{LEFT}") Next ;End of loop EndIf $pixel = PixelSearch(425, 518, 481, 567, 14655792, 0, 1) If NOT @error Then For $i = 0 To 30 ControlSend($win, "", "", "{RIGHT}") Next ;End of loop EndIf WEnd EndFunc Link to comment Share on other sites More sharing options...
water Posted December 7, 2015 Share Posted December 7, 2015 Can you please tell us which program you try to automate? So maybe we can suggest a more reliable solution. 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...
bosk20 Posted December 7, 2015 Author Share Posted December 7, 2015 (edited) Problem solved. Thank you for answers. I do not know why it did not work beforeLocal $i = 0 While $i <= 30 $pixel = PixelSearch(422, 413, 479, 463, 14655792, 0, 1) If NOT @error Then ControlSend($win, "", "", "{LEFT}") $i += 1 EndIfNow is working perfectly Edited December 7, 2015 by bosk20 Edit 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