Falling Posted October 4, 2004 Share Posted October 4, 2004 Is there a conversion for this? I want to know how to use the information for http sytax: rgb(R%,G%,B%) in autospy it tells you this information: Pixel Color Under Mouse (RGB) Hex: 0x00899F Dec: 35231 But how do i go from this to percentages? Is there just a simple formula? Link to comment Share on other sites More sharing options...
Josbe Posted October 4, 2004 Share Posted October 4, 2004 (edited) Dec to RGB: MsgBox(0, "", _Dec2RGB(35231)) ;// Decimal to RGB Func _Dec2RGB($_DecColor) Local $R = BitAND( BitShift($_DecColor, 16), 0xff) Local $G = BitAND( BitShift($_DecColor, 8), 0xff) Local $B = BitAND($_DecColor, 0xff) Return $R & ", " & $G & ", " & $B EndFunc Output: --------------------------- 0, 137, 159 --------------------------- EDIT: Function with an example. Edited October 4, 2004 by josbe jaberwacky 1 AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta Link to comment Share on other sites More sharing options...
Falling Posted October 4, 2004 Author Share Posted October 4, 2004 Thanks man. Here is what i ended up doing. ;// Decimal to RGB Func _RGB($_DecColor) Local $R = BitAND( BitShift($_DecColor, 16), 0xff) Local $G = BitAND( BitShift($_DecColor, 8), 0xff) Local $B = BitAND($_DecColor, 0xff) Return $R & ", " & $G & ", " & $B EndFunc $a = InputBox("Enter Dec", "Enter Dec Value:") $b = _RGB($a); MsgBox(0, "RGB value", "The RGB value is: " & $b) What would be real fancy is to make a program that lets you mouse over a color then left click and it brings up a message box that tells you the RGB values. I might try to do that in a bit, but seems like a lot of work to do for somthing that is already so easy---> thanks mainly in part from your help here. I don't understand too well how bit shifting works. If anyone wants to give me a long explination I'd read it, or if anyone knows a good book to read post it. Just a note out there the BitAND in the help file has an error in it. $y = BitShift(14, -2) ; y == 48 because 1110b left-shifted twice is 111000b == 56 y cannot == 48 and 56. -------------------------------------------------------- Link to comment Share on other sites More sharing options...
Josbe Posted October 4, 2004 Share Posted October 4, 2004 What would be real fancy is to make a program that lets you mouse over a color then left click and it brings up a message box that tells you the RGB values...Yeah. At the moment I have script that does this (PixelFinder), but I need to do some fixes yet. AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta 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