lesliespawpaw Posted July 6, 2009 Report Share Posted July 6, 2009 I recently upgraded to Macroexpress pro and was very excited to be able to use hex numbers as 0x4F56FF. However, I can not find how to display a variable in a text box in hex. I have searched the help files and there is no info to be found. Is this possible?? Thanks Jimmy Lyon Quote Link to comment Share on other sites More sharing options...
terrypin Posted July 6, 2009 Report Share Posted July 6, 2009 I recently upgraded to Macroexpress pro and was very excited to be able to use hex numbers as 0x4F56FF. However, I can not find how to display a variable in a text box in hex. I have searched the help files and there is no info to be found. Is this possible?? Thanks Jimmy Lyon Please clarify what you are doing with the hex numbers. I didn't know you could do hex calculations in MEP? -- Terry, East Grinstead, UK Quote Link to comment Share on other sites More sharing options...
lesliespawpaw Posted July 8, 2009 Author Report Share Posted July 8, 2009 Please clarify what you are doing with the hex numbers. I didn't know you could do hex calculations in MEP? -- Terry, East Grinstead, UK Not trying to do anything with the number except display it in a text box from a variable. In the mouse locator color of a pixel is shown in both hex and decimal. I prefer to us the hex version, when a variable is displayed in a text box it is in decimal and harder to remember. Jimmy Lyon Quote Link to comment Share on other sites More sharing options...
stevecasper Posted July 8, 2009 Report Share Posted July 8, 2009 Not trying to do anything with the number except display it in a text box from a variable.In the mouse locator color of a pixel is shown in both hex and decimal. I prefer to us the hex version, when a variable is displayed in a text box it is in decimal and harder to remember. Jimmy Lyon So you are using the Get Pixel Color command, is that right? There is no HEX variable in MEP, so Integer is the only option for saving the pixel color. Though, I can certainly see an opportunity for a feature request ( http://macros.com/requestfeature.htm ) allowing the user to select a Text variable to save the Hexadecimal color, as opposed to using the Integer variable default. Quote Link to comment Share on other sites More sharing options...
lesliespawpaw Posted July 8, 2009 Author Report Share Posted July 8, 2009 So you are using the Get Pixel Color command, is that right? There is no HEX variable in MEP, so Integer is the only option for saving the pixel color. Though, I can certainly see an opportunity for a feature request ( http://macros.com/requestfeature.htm ) allowing the user to select a Text variable to save the Hexadecimal color, as opposed to using the Integer variable default. I guess I am not being specific enough. When you open the mouse locator and move over a pixel it returns 2 numbers 14851196 (decimal) and 0x7C9CE2 (HEX). This is the blue color in the mouse locator window. Using the get pixel color at specific location command to a variable. Then the if variable equals this value can be entered into MEP as 0x7C9CE2 for a test. If you use display text box to look at the value of that variable the text box will print 14851196. I just prefer to use hex values as they are shorter. There is probably no way to have a text box display a value as hex. But since MEP started using hex for input I assumed it should display it as well Thanks Jimmy Lyon Quote Link to comment Share on other sites More sharing options...
stan Posted July 8, 2009 Report Share Posted July 8, 2009 Actually the hex value is also available for display in Macro Express 3. You have to open Options | Preferences | Miscellaneous and click on the Advanced button to turn on this option. Currently there is not a way to display the hex value in a text box. I would suggest making a feature request. We can see some value to adding this ability to the program. Quote Link to comment Share on other sites More sharing options...
terrypin Posted July 8, 2009 Report Share Posted July 8, 2009 I guess I am not being specific enough. When you open the mouse locator and move over a pixel it returns 2 numbers 14851196 (decimal) and 0x7C9CE2 (HEX). This is the blue color in the mouse locator window.Using the get pixel color at specific location command to a variable. Then the if variable equals this value can be entered into MEP as 0x7C9CE2 for a test. If you use display text box to look at the value of that variable the text box will print 14851196. I just prefer to use hex values as they are shorter. There is probably no way to have a text box display a value as hex. But since MEP started using hex for input I assumed it should display it as well Thanks Jimmy Lyon What makes you think MEP "...started using hex for input" ? The Mouse Locator displays the hex value but it only makes the integer value available. As it says in Help: Get Pixel Color Use the Get Pixel Color option to obtain the pixel color underneath the mouse pointer. The pixel color is assigned a numeric value by Windows, normally 6 - 8 digits in length. This numeric value is then saved to an Integer variable such as N[1]. -- Terry, East Grinstead, UK Quote Link to comment Share on other sites More sharing options...
Cory Posted July 17, 2009 Report Share Posted July 17, 2009 Why don't you just convert the integer value to hex and store that in a string var? You can do the math, it's just like long division, or you could fire up the windows calculator (calc.exe) invisibly and use the controls to convert. Pure blue for instance is 16711680 and if you convert it to hex it's FF0000 (Blue=FF, Green=00, Red=00). FYI I leave off the 0x prefix which denotes the number as hexadecimal based for clarity. You now just need to rearrange the hex triplets to 0000FF because the integer pixel color is in BGR, not RGB. Easy. But if it were me I would just do the math. Simply divide by 16 iteratively until zero and record the remainders which will occur in reverse order. For your number 14851196 I get: 14851196/16=928199 R12 (12 in integer is C in hex) 928199/16=58012 R7 (7) 58012/16=3625 R12 © 3625/16=226 R9 (9) 226//16=14 R2 (2) 14/16=0 R14 (E) So that's E29C7C but remember the integer value appears to be in BGR not RGB so just rearrange the triplets to 7C9CE2. In case you didn't know the hex value is the concentrations of the components red green and blue in values of 0-255 which is 00-FF in hex. EG pure blue is 0000FF manging 00 of red, 00 of green, and 255 or FF of blue. If you don't get how to write the script for this just let me know and I'll do it for you. I've been wanting to create a script that would tolerate small variations in pixel color and I don't see any way of doing it without getting the component values for each color and tolerating a small variation on each. Quote Link to comment Share on other sites More sharing options...
stevecasper Posted July 17, 2009 Report Share Posted July 17, 2009 Why don't you just convert the integer value to hex and store that in a string var? You can do the math, it's just like long division, or you could fire up the windows calculator (calc.exe) invisibly and use the controls to convert. Pure blue for instance is 16711680 and if you convert it to hex it's FF0000 (Blue=FF, Green=00, Red=00). FYI I leave off the 0x prefix which denotes the number as hexadecimal based for clarity. You now just need to rearrange the hex triplets to 0000FF because the integer pixel color is in BGR, not RGB. Easy. But if it were me I would just do the math. Simply divide by 16 iteratively until zero and record the remainders which will occur in reverse order. For your number 14851196 I get:14851196/16=928199 R12 (12 in integer is C in hex) 928199/16=58012 R7 (7) 58012/16=3625 R12 © 3625/16=226 R9 (9) 226//16=14 R2 (2) 14/16=0 R14 (E) So that's E29C7C but remember the integer value appears to be in BGR not RGB so just rearrange the triplets to 7C9CE2. In case you didn't know the hex value is the concentrations of the components red green and blue in values of 0-255 which is 00-FF in hex. EG pure blue is 0000FF manging 00 of red, 00 of green, and 255 or FF of blue. D'oh! I was gonna say that! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.