d3adlin3 Posted June 29, 2007 Share Posted June 29, 2007 Hi, Im having problems with PixelGetColor. Im trying to get the colour of a button inside a window and if its Black todo X. When I currently do PixelGetColor it doesnt detect the colour even thoe its definatly the right co ords; I think the problem is due to PixelGetColor not being in 'Client Co Ord 'mode? I just dont know how to turn that mode on (if that is the problem). Heres the function with the problem, and the settings linked with it: $WHConnectedTitle = "connected" $WHAX=40 $WHAY=13 $WHAColour="000000" AutoItSetOption ( "PixelCoordMode", 0 ) Opt("GUICoordMode", 1) Opt("MouseCoordMode", 2) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func ConnectWH() WinActivate($WHConnectedTitle) ;; Activate Main WH Window Sleep(1000) ;; Pause MouseClick("Left", 17, 12) ;; Select Green Button $WHAColour_var = PixelGetColor($WHAX,$WHAY);; Get Colour of A Button $WHAColour_hex = Hex($WHAColour_var, 6) ;; Converts it to Hex If $WHAColour_hex = $WHAColour Then ;; MsgBox(1,"True","True") ;; Else ;; Else MsgBox(1,"False","False") ;; EndIf EndFunc Thanks for any help D3ADLiN3 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 29, 2007 Moderators Share Posted June 29, 2007 Look at Opt() in the help file. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Leighwyn Posted June 29, 2007 Share Posted June 29, 2007 (edited) Hi, Im having problems with PixelGetColor. Im trying to get the colour of a button inside a window and if its Black todo X. When I currently do PixelGetColor it doesnt detect the colour even thoe its definatly the right co ords; I think the problem is due to PixelGetColor not being in 'Client Co Ord 'mode? I just dont know how to turn that mode on (if that is the problem). Heres the function with the problem, and the settings linked with it: $WHConnectedTitle = "connected" $WHAX=40 $WHAY=13 $WHAColour="000000" AutoItSetOption ( "PixelCoordMode", 0 ) Opt("GUICoordMode", 1) Opt("MouseCoordMode", 2) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func ConnectWH() WinActivate($WHConnectedTitle) ;; Activate Main WH Window Sleep(1000) ;; Pause MouseClick("Left", 17, 12) ;; Select Green Button $WHAColour_var = PixelGetColor($WHAX,$WHAY);; Get Colour of A Button $WHAColour_hex = Hex($WHAColour_var, 6) ;; Converts it to Hex If $WHAColour_hex = $WHAColour Then ;; MsgBox(1,"True","True") ;; Else ;; Else MsgBox(1,"False","False") ;; EndIf EndFunc Thanks for any help D3ADLiN3 PixelCoordMode Sets the way coords are used in the pixel functions, either absolute coords or coords relative to the current active window: 0 = relative coords to the active window 1 = absolute screen coordinates (default) 2 = relative coords to the client area of the active window if you think that's the problem, that's how you do it. as it is right now, with mode=0, you would have to have defined your coordinate relative to your active window. Since it looks like your mouse coords are in mode 2, which is rel. to client area, that may be the problem Edited June 29, 2007 by Leighwyn 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