mcfreal Posted October 16, 2009 Share Posted October 16, 2009 I need for it to find the grey (#555555) pixel in the box at 106 left 89 top. Then repeatedly press 2 (waiting 300 ms in between each), until it finds the blue (#04ACEB). I don't believe "Until $color=PixelSearch(203,82,206,100,0x04ACEB) not @error" (Until it finds the blue in the box). is valid but I'm new to this. Any ideas on how I can fix it? While True If $use = 1 Then $size = WinGetClientSize("RagII", "") $color=PixelSearch(106,82,109,100,0x555555) ; If PixelSearch finds the pixel color at given coordinates, Then: If Not @error Then Do Send(2) Sleep(300) Until $color=PixelSearch(203,82,206,100,0x04ACEB) not @error EndIf EndIf WEnd Link to comment Share on other sites More sharing options...
Zedna Posted October 16, 2009 Share Posted October 16, 2009 Probably something like this While True If $use = 1 Then $size = WinGetClientSize("RagII", "") $color=PixelSearch(106,82,109,100,0x555555) ; If PixelSearch finds the pixel color at given coordinates, Then: If Not @error Then While 1 $color=PixelSearch(203,82,206,100,0x04ACEB) If @error Then ExitLoop Send(2) Sleep(300) WEnd EndIf EndIf WEnd Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
mcfreal Posted October 16, 2009 Author Share Posted October 16, 2009 (edited) Probably something like this While True If $use = 1 Then $size = WinGetClientSize("RagII", "") $color=PixelSearch(106,82,109,100,0x555555) ; If PixelSearch finds the pixel color at given coordinates, Then: If Not @error Then While 1 $color=PixelSearch(203,82,206,100,0x04ACEB) If @error Then ExitLoop Send(2) Sleep(300) WEnd EndIf EndIf WEnd So would "If @error Then ExitLoop" actually cease the looping or just start the loop from the beginning? I need it to keep pressing 2 over and over until it finds that 0x04ACEB pixel, then go all the way back to the beginning of the script, not just the loop. Still not working. Most recent revision: While 1 Do $color=PixelSearch(106,82,109,100,0x555555) Until Not @error While 1 $color=PixelSearch(203,82,206,100,0x04ACEB) If @error Then ExitLoop Send(2) WEnd WEnd Edited October 16, 2009 by mcfreal Link to comment Share on other sites More sharing options...
Zedna Posted October 16, 2009 Share Posted October 16, 2009 So would "If @error Then ExitLoop" actually cease the looping or just start the loop from the beginning? I need it to keep pressing 2 over and over until it finds that 0x04ACEB pixel, then go all the way back to the beginning of the script, not just the loop. Still not working. Most recent revision: What about this? While True If $use = 1 Then $size = WinGetClientSize("RagII", "") $color=PixelSearch(106,82,109,100,0x555555) ; If PixelSearch finds the pixel color at given coordinates, Then: If Not @error Then While 1 $color=PixelSearch(203,82,206,100,0x04ACEB) If Not @error Then ExitLoop Send(2) Sleep(300) WEnd EndIf EndIf WEnd Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
mcfreal Posted October 16, 2009 Author Share Posted October 16, 2009 I'm about to give it a shot, bump Link to comment Share on other sites More sharing options...
mcfreal Posted October 16, 2009 Author Share Posted October 16, 2009 (edited) Success! <3s Zedna While 1 Do $color=PixelSearch(106,82,109,100,0x555555) Until Not @error While 1 $color=PixelSearch(203,82,206,100,0x04ACEB) If not @error Then ExitLoop Send(2) WEnd WEnd Edited October 16, 2009 by mcfreal 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