cag8f Posted August 11, 2014 Posted August 11, 2014 I'm using the Autoit Windows Information Tool to determine the pixel coordinate ($X, $Y) and color hex value (lime green, 0x00FF00). But when I then run a simple Autoit script to confirm this: hex(PixelGetColor($X, $Y) I am met with a different color hex value (0000DD00). Shouldn't the 2 hex values match? If so, am I doing something wrong? I found this old post describing a similar issue. '?do=embed' frameborder='0' data-embedContent>> I tried to follow the recommendations but encountered a problem. I made sure that the Coord Mode in AutoItInfo was set to 'screen,' but I couldn't find where to set Opt("PixelCoordMode", ?). It doesn't appear to be in the User Options or Global Options files. Thanks in advance.
Moderators JLogan3o13 Posted August 11, 2014 Moderators Posted August 11, 2014 Just out of curiosity, what is the end result once you get the hex value (e.g. what are you trying to manipulate)? There is likely (almost always) and easier way to accomplish what you're after than having to resort to matchin pixel colors. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
cag8f Posted August 11, 2014 Author Posted August 11, 2014 The colors, and use of Autoit to determine those colors, are the end result. I'm teaching an introductory programming class to high school students and wanted to do this as a lesson. But this is behavior I can't explain, so I'd like to understand what is happening before the lesson.
JohnOne Posted August 11, 2014 Posted August 11, 2014 Is Window info tool in absolute or window or client mode? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
cag8f Posted August 11, 2014 Author Posted August 11, 2014 I tried all 3 and get the same results with each.
JohnOne Posted August 11, 2014 Posted August 11, 2014 Does this give you all the same colour? $y = 0 For $x = 0 To @DesktopWidth Step 10 ConsoleWrite("0x" & Hex(PixelGetColor($x, $y), 6) & @LF) $y += 8 Next AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
cag8f Posted August 11, 2014 Author Posted August 11, 2014 (edited) No it does not. edit: should it have? Edited August 11, 2014 by cag8f
JohnOne Posted August 11, 2014 Posted August 11, 2014 It's possible but doubtful. My guess is there is more to your code and it's calculation of x and y, and that is where your problem lies. Or perhaps you have some weird DPI setting. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Solution Malkey Posted August 11, 2014 Solution Posted August 11, 2014 ... I found this old post describing a similar issue. '?do=embed' frameborder='0' data-embedContent>> I tried to follow the recommendations but encountered a problem. I made sure that the Coord Mode in AutoItInfo was set to 'screen,' but I couldn't find where to set Opt("PixelCoordMode", ?). It doesn't appear to be in the User Options or Global Options files. Thanks in advance. To be put near the top of your script, below any include files. Opt("PixelCoordMode", 1) ;1=absolute, 0=relative, 2=client
cag8f Posted August 12, 2014 Author Posted August 12, 2014 @Malkey, thank you. I added that code though, but with the same results. @JohnOne. Thanks for your help. >> My guess is there is more to your code and it's calculation of x and y, and that is where your problem lies. For testing purposes, I've reduced my code down to one line: ConsoleWrite(hex(PixelGetColor($X,$Y), 6) & @CR) Anyone else have any ideas why this is happening?
BrewManNH Posted August 12, 2014 Posted August 12, 2014 I can't duplicate your issue, I tested with a pixel on the desktop background, and one inside the browser window. PixelGetColor was returning the same value as the info tool. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
cag8f Posted August 12, 2014 Author Posted August 12, 2014 OK thanks for that info. The difference in colors is very small: 00FF00, 00DD00. So perhaps: 1. AU3info does uses a slightly different algorithm than pixelgetcolor() when calculating colors. Highly unlikely, and maybe not even possible. or 2. Since the colors are shades of themselves (lime green), they could be neighboring pixels. So perhaps the coordinate systems between my AU3info and pixelgetcolor() are slightly off. I will try to troubleshoot that more, perhaps by checking the coordinates/colors of the corner pixels. I'll post back here if anyone's interested.
Malkey Posted August 12, 2014 Posted August 12, 2014 (edited) Using this example, I get the same mouse position and color on the tool tip as is on AU3info.HotKeySet("{ESC}", "Terminate") Local $aMPos While 1 $aMPos = MouseGetPos() ToolTip($aMPos[0] & ", " & $aMPos[1] & @LF & "0x" & Hex(PixelGetColor($aMPos[0], $aMPos[1]), 6)) Sleep(10) WEnd Func Terminate() Exit 0 EndFunc ;==>TerminateEdit:Added Sleep.Note: When the screen changes color without the mouse moving, I found the tool tip changes but the Au3Info color does not change until the mouse is moved. Edited August 12, 2014 by Malkey
cag8f Posted August 12, 2014 Author Posted August 12, 2014 OK resolved for now. User error I guess. I had set Opt("PixelCoordMode", 0) Instead of Opt("PixelCoordMode", 1) Making that change gives me consistent colors. Thanks for everyone's help!
JohnOne Posted August 12, 2014 Posted August 12, 2014 It is still strange, by default PixelCoordMode has always been 1 for me. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Nitrolord Posted January 2, 2017 Posted January 2, 2017 (edited) On 8/11/2014 at 11:54 AM, cag8f said: I'm using the Autoit Windows Information Tool to determine the pixel coordinate ($X, $Y) and color hex value (lime green, 0x00FF00). But when I then run a simple Autoit script to confirm this: hex(PixelGetColor($X, $Y) I am met with a different color hex value (0000DD00). Shouldn't the 2 hex values match? If so, am I doing something wrong? I found this old post describing a similar issue. '?do=embed' frameborder='0' data-embedContent>> I tried to follow the recommendations but encountered a problem. I made sure that the Coord Mode in AutoItInfo was set to 'screen,' but I couldn't find where to set Opt("PixelCoordMode", ?). It doesn't appear to be in the User Options or Global Options files. Thanks in advance. I know this post is old but if your still wondering and for others who are still looking for the solution Check out my post. Edited January 2, 2017 by Nitrolord
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