asan Posted January 23, 2010 Share Posted January 23, 2010 this is what i have which is working, but i dont know how to add another left click after it finds my $iColor. after it finds the $icolor i need it to left click at these coordinates x=574 y=397. now after it clicks the coordinates i need it to keep searching for the $icolor, make any sense lol, also the reason i hve it clicking the x,y is because its a pop up box in flash and thats the only way i know how to hit the ok button lol thanks sorry im trying to learn. thanks for any help HotKeySet('{esc}', '_Exit') Global $iColor = 0xE4EBFF While 1 sleep(100) $coord = PixelSearch( 11, 78, 539, 779, $iColor ) If Not @error Then MouseClick("left", $coord[0], $coord[1],2,0) ConsoleWrite("X and Y are:" & $coord[0] & "," & $coord[1]) EndIf WEnd Func _Exit() ToolTip(' '&@CRLF&' EXITING '&@CRLF&' ') Sleep(500) Exit EndFunc Link to comment Share on other sites More sharing options...
JohnOne Posted January 23, 2010 Share Posted January 23, 2010 Just put the mouse click between your If and EndIf. 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...
asan Posted January 23, 2010 Author Share Posted January 23, 2010 Just put the mouse click between your If and EndIf.ok will trythank you Link to comment Share on other sites More sharing options...
asan Posted January 23, 2010 Author Share Posted January 23, 2010 getting an error now after it finds the $icolor after adding in another left click at y,x here is what i added HotKeySet('{esc}', '_Exit') Global $iColor = 0xE4EBFF While 1 sleep(100) $coord = PixelSearch( 11, 78, 539, 779, $iColor ) If Not @error Then MouseClick("left", $coord[0], $coord[1],2,0) ConsoleWrite("X and Y are:" & $coord[0] & "," & $coord[1]) MouseClick( "left", 574, 397, 2, 0 ) EndIf WEnd Func _Exit() ToolTip(' '&@CRLF&' EXITING '&@CRLF&' ') Sleep(500) Exit EndFunc Link to comment Share on other sites More sharing options...
ForsakenGod Posted January 23, 2010 Share Posted January 23, 2010 (edited) Hey hey well i dont see any serious mistakes there HotKeySet('{esc}', '_Exit') Global $iColor = 0xE4EBFF While 1 sleep(100) ToolTip(" Searching for color",0,0) $coord = PixelSearch( 11, 78, 539, 779, $iColor ) If @error = 0 Then ToolTip(" Color found -clicking",0,0) MouseClick("left", $coord[0], $coord[1],2,0) MouseClick("left", 574, 397, 2, 0) EndIf WEnd Func _Exit() ToolTip(' '&@CRLF&' EXITING '&@CRLF&' ',0,0) Sleep(500) Exit EndFunc With this i didnt get errors at all you may try it if it crashes please read the autoit console and let us know Edited January 23, 2010 by ForsakenGod Link to comment Share on other sites More sharing options...
asan Posted January 23, 2010 Author Share Posted January 23, 2010 Hey hey well i dont see any serious mistakes there HotKeySet('{esc}', '_Exit') Global $iColor = 0xE4EBFF While 1 sleep(100) ToolTip(" Searching for color",0,0) $coord = PixelSearch( 11, 78, 539, 779, $iColor ) If @error = 0 Then ToolTip(" Color found -clicking",0,0) MouseClick("left", $coord[0], $coord[1],2,0) MouseClick("left", 574, 397, 2, 0) EndIf WEnd Func _Exit() ToolTip(' '&@CRLF&' EXITING '&@CRLF&' ',0,0) Sleep(500) Exit EndFunc With this i didnt get errors at all you may try it if it crashes please read the autoit console and let us know thanks no errors on it, just need to try and tweak it a little bit, its not clicking my pop up box i tried increasing the number of clicks but it still needs a bit of work. HotKeySet('{esc}', '_Exit') Global $iColor = 0xE4EBFF While 1 sleep(100) ToolTip(" Searching for color",0,0) $coord = PixelSearch( 11, 78, 539, 779, $iColor ) If @error = 0 Then ToolTip(" Color found -clicking",0,0) MouseClick("left", $coord[0], $coord[1],2,0) MouseClick("left", 574, 397, 10, 4) EndIf WEnd Func _Exit() ToolTip(' '&@CRLF&' EXITING '&@CRLF&' ',0,0) Sleep(500) Exit EndFunc Link to comment Share on other sites More sharing options...
asan Posted January 25, 2010 Author Share Posted January 25, 2010 ok I tried switching it up a bit. the first code code works it searches for the pixel then clicks it, now im trying to find a second pixel and then click that after it finds the first, i'm getting an error now, so I know something is wrong lol, hey i'm trying. ok so after it clicks the first pixel i need it to click the next color pixel 3 times to make sure it clciks it, then keep searching for the first pixel after the second pixel is clicked, here is what i have so far. thanks for the help, I dont know if i can do a $coord2 like that lol HotKeySet('{esc}', '_Exit') Global $iColor = 0xE4EBFF While 1 sleep(100) ToolTip(" Searching for snowflake",0,0) $coord = PixelSearch( 11, 78, 539, 779, $iColor ) If @error = 0 Then ToolTip(" Snowflake found -clicking",0,0) MouseClick("left", $coord[0], $coord[1],2,0) $coord2 = PixelSearch ( 20, 25, 915, 525, 0x00bfd8, 6 ) MouseClick("left", $coord2[0], $coord2[1],2,0) ToolTip(" Closing Pop up",0,0) EndIf WEnd Func _Exit() ToolTip(' '&@CRLF&' EXITING '&@CRLF&' ',0,0) Sleep(500) Exit EndFunc Link to comment Share on other sites More sharing options...
asan Posted January 25, 2010 Author Share Posted January 25, 2010 tried switching the code up a bit but still getting an error here is what i re did Thanks for any help asan HotKeySet('{esc}', '_Exit') Global $iColor = 0xE4EBFF Global $iColor2 = 0x00BFD8 While 1 sleep(100) ToolTip(" Searching for snowflake",0,0) $coord = PixelSearch( 11, 78, 539, 779, $iColor ) If @error = 0 Then ToolTip(" Snowflake found -clicking",0,0) MouseClick("left", $coord[0], $coord[1],2,0) $coord2 = PixelSearch ( 20, 25, 915, 525, $iColor2, 6 ) MouseClick("left", $coord2[0], $coord2[1],2,0) EndIf WEnd Func _Exit() ToolTip(' '&@CRLF&' EXITING '&@CRLF&' ',0,0) Sleep(500) Exit 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