inmysights Posted August 2, 2009 Posted August 2, 2009 Where am I going wrong please? WinActivate("Myactive window") AutoItSetOption ( "MouseCoordMode" , 2 ) AutoItSetOption ( "PixelCoordMode" , 2 ) MouseClickDrag("left",677, 685, 500, 300) ;Find a pure white pixel or a white pixel within 10 shades variations of white $coord = PixelSearch( 676, 684, 678, 686, 0xC6D2DE, 10 ) If Not @error Then (0, "X and Y are:", $coord[0] & "," & $coord[1]) EndIf If IsArray($coord) = 1 Then MouseMove(677,685) MouseClick("left") EndIf I used the v3 too, to get the hex color. it runs without errors just logic seems incorrect. Is the pixel detection I am doing in the same window I have focus on? the pixel stored at 677,685 is that shade of white, so this should work. But the check fails, like the color is wrong. What am I missing please? Thank you
Valuater Posted August 2, 2009 Posted August 2, 2009 Shade of white??? ... No!! ;WinActivate("Myactive window") Opt("MouseCoordMode", 0) Opt("PixelCoordMode", 0) GUICreate("My GUI", @DesktopWidth, @DesktopHeight) GUISetBkColor(0xC6D2DE) GUISetState() MouseClickDrag("left", 677, 685, 500, 300) ;Find a pure white pixel or a white pixel within 10 shades variations of white $coord = PixelSearch(676, 684, 678, 686, 0xC6D2DE, 10) If Not @error Then MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1]) EndIf If IsArray($coord) Then MouseMove(677, 685) MouseClick("left") EndIf 8)
inmysights Posted August 2, 2009 Author Posted August 2, 2009 how can I do this with an active window, and not my desktop? what I am trying to do is if that white pixel changes I want the left button to click, so I am just setting it right off to make it work but it doesn't. So I am guessing my logic is correct? or you would have said something about it?
Valuater Posted August 2, 2009 Posted August 2, 2009 Just a guess here... $Color = "0x" & Hex(PixelGetColor( 677, 685), 6) MsgBox(4096,"Color", $Color) ; ***** above is to test the color only ***** If Not $Color = "0xC6D2DE" Then MouseClick("left", 677, 685) MsgBox(4096,"Test","That worked") EndIf 8)
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