Bert Posted May 11, 2006 Share Posted May 11, 2006 I made this script to get a pixel color when you click. Opt("PixelCoordMode",2) Opt("MouseCoordMode",2) Opt("ColorMode", 0) #Include <Misc.au3> $v_dll = 'user32.dll' $mschk = MouseGetPos() while 1 if _IsPressed(01,$v_dll) then $mschk = MouseGetPos() $colorwin = PixelGetColor($mschk[0], $mschk[1]) $ms = MsgBox(1,"",$colorwin & @CRLF & "X =" & $mschk[0] & " Y = " & $mschk[1]) if $ms = 2 then exit endif endif sleep(20) WEnd I expect the format on the return to be in the format 0xRRGGBB, What I get is this: 16777215 According to the help file, I can set the colormode to RGB by setting it to "0", but this makes no difference. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Bert Posted May 11, 2006 Author Share Posted May 11, 2006 in further reading of the helpfile, I find the sentence where it says "Returns decimal value of pixel's color." Now I get it, but how do I get it to return the RGB value? The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 11, 2006 Moderators Share Posted May 11, 2006 (edited) in further reading of the helpfile, I find the sentence where it says "Returns decimal value of pixel's color." Now I get it, but how do I get it to return the RGB value?Hmmm, It returns RGB automatically (You'd have to do something entirely different to get BGR), it returns it in decimal, if you want the "Hex" value, simply do:$var = '0x' & Hex(PixelGetColor(x, y), 6) Edit: This is assuming as long as you've been using AutoIt that your using the latest beta of course Edited May 11, 2006 by SmOke_N 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...
Bert Posted May 11, 2006 Author Share Posted May 11, 2006 (edited) Ah, I put in the code, and it works nicely. I coded it so it will return both ways. Opt("PixelCoordMode",2) Opt("MouseCoordMode",2) Opt("ColorMode", 0) #Include <Misc.au3> $v_dll = 'user32.dll' $mschk = MouseGetPos() while 1 if _IsPressed(01,$v_dll) then $mschk = MouseGetPos() $colorwin = PixelGetColor($mschk[0], $mschk[1]) $colorwin1 = '0x' & Hex(PixelGetColor($mschk[0], $mschk[1]), 6) $ms = MsgBox(1,"",$colorwin & " = Decimal value" & @CRLF & $colorwin1 & " = Hex value"& @CRLF & "X =" & $mschk[0] & " Y = " & $mschk[1]) if $ms = 2 then exit endif endif sleep(20) WEnd I'm thinking of adding this to the SciTE toolbar. Thoughts? Edited May 11, 2006 by vollyman The Vollatran project My blog: http://www.vollysinterestingshit.com/ 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