Vane Posted September 14, 2012 Share Posted September 14, 2012 Hello everyone. I'm new to AutoIt so i'm sorry if this is a simple minded question. I'm trying to make a script to: - Use PixelSearch to search a color in a frame - If color is to be found, run a function, - - check again for the color, - - if it is still found, run function again over and over - when color is not found, change frame - do it all over again until frame is done - repeat by x number of frames. My problem is I can not end Do - Until loop once it has started. It detects the color I want to detect (true and false value), but even after reaching the desired result it continues in the loop ("There it is" when there it is not). Func CheckClick($posX, $posY, $posX2, $posY2, $th) OpenSy() ToolTip("looking",0,0) Local $coord = PixelSearch($posX, $posY, $posX2, $posY2, 0x15374e, 15) If @error Then MsgBox(0, "???", "Not found") NextThumbnail($th) Else Do MsgBox(0, "???", "There it is") Filter1() Filter2() Sleep(1000) OpenSy() $coord = PixelSearch($posX, $posY, $posX2, $posY2, 0x15374e, 15) Until $coord = @error, EndIf EndFunc I'm not Sure Do-Until is the best thing to do, or a While either. Any pointing would be appreciated. Thanks. Link to comment Share on other sites More sharing options...
water Posted September 14, 2012 Share Posted September 14, 2012 Welcome to AutoIt and the forum! Can you please tell us which application you try to automate? Maybe there is an easier way to do what you want. 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...
JohnOne Posted September 14, 2012 Share Posted September 14, 2012 Change Until $coord = @errorToUntil @errorAnd get rid of the comma. 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...
Vane Posted September 15, 2012 Author Share Posted September 15, 2012 Welcome to AutoIt and the forum! Can you please tell us which application you try to automate? Maybe there is an easier way to do what you want. Hello, I'm trying to automate a program named GraphicsGale. It's like paint but a bit more to pixel art and animation. Change Until $coord = @error To Until @error And get rid of the comma. Thank you, that fixed it. Thanks everyone for the fast response. This is how the code ended up, if anyone has any use for it: Func ColorCheck($NoT, $StartX, $Area) OpenSy() Posit() $i = 0 $Rt = $StartX Do DoRow($Rt) $Rt = $Rt + $Area $i = $i + 1 Until $i = $NoT MouseClick("primary", 455, 585, 1, 5) EndFunc Func DoRow($Yi, $StartY, $Color, $Area) $Xc=$StartY $Yc=$Yi Do Local $coord = PixelSearch($Xc, $Yc, $Xc+2, $Yc+2, $Color, 15) ;not broken color If @error Then $Xc = $Xc + $Area Else Do SelectIt($Xc+2, $Yc+2) Filter1() Filter2() OpenSy() Posit() $coord = PixelSearch($Xc, $Yc, $Xc+2, $Yc+2, $Color, 15) Until @error EndIf Until $Xc > 900 ;( 874 is max ) ;MsgBox(0, "???", "FINISHED ROW", 1) EndFunc 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