Jump to content

AUInfo Reading info under mouse on 2560x1440 screen wrong


Recommended Posts

Hi All,

I'm trying to run a script to fire when a pixel at a certain location on the screen changes to a particular colour, however auinfo is unable to measure the colour where my cursor is due to my high resolution - 2560x1440 on a 13.3" laptop. Does anyone have a workaround or a fix for this?

If I move my mouse to the bottom-right corner of the screen auinfo reports the mouse position as about 1280x720, 1/2 my actual resolution.

Thanks!

Link to comment
Share on other sites

That must be one hell of a monitor to achieve that resolution on such a small screen. What does @DesktopHeight and @DesktopWidth return when your script is running?

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 Gude
How 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

Link to comment
Share on other sites

That looks like a sweet laptop. :)

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 Gude
How 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

Link to comment
Share on other sites

@DesktopWidth = 1280

@DesktopHeight = 720

Actual Screen resolution 2560 x 1440, so it's exactly 1/2 of the actual resolution. I've heard the same with other people with these high resolutions. I get the same result if I use a pixel colour app to show the colour of the pixel under the cursor, seems apps just haven't caught up yet.

There's probably a way of programatically showing a virtual cursor location on screen as I move the mouse so I can see where it is actually resting and then take a location and colour reading?

Link to comment
Share on other sites

Not sure what you mean with a gradient but if you can make a full screenshot to a bmp then you can grab every pixel you want or load it into gdi functions to manipulate. Search for findbmp and you will see how to get your screenpixels in a huge array. Other options are in the forum to run a fasm script in assembly to quickly analyse pixels.

Could this be the cause

https://social.msdn.microsoft.com/Forums/en-US/3bd3f425-a93d-47eb-b3c0-795bc2458b29/getsystemmetrics-returns-incorrect-screen-size-in-windows-mobile?forum=vssmartdevicesnative

Link to comment
Share on other sites

Thanks. By gradient what I mean is I am wanting to read a pixel colour change if a message appears, however the message itself has a gradient from mid blue at the top to dark blue at the bottom of the background, it is not a single colour. I'll have a look around for those tools you mentioned - cheers.

I threw this script together, I'll try it tonight and see where the cursor moves to and the colour it picks up, then just increment/decrement the values until it's in the right position, at which point I can convert the decimal colour to hex to see if it's roughly the right colour (eg http://www.w3schools.com/tags/ref_colorpicker.asp).

$width = 1000
$hight = 700
MouseMove($width,$hight)
$pixcolour = PixelGetColor($width,$hight)
$pixhex = hex($pixcolour,6)
ClipPut($pixhex)
MsgBox(0, "Pixel Colour", "Dec: " & $pixcolour & " Hex: " & $pixhex)

 

Link to comment
Share on other sites

  • Administrators

I'd guess that you are running with a dpi scaling setting of something other than 100%. Sounds like 200%. AutoIt doesn't have the resource manifest HighDpi set, so screen operations get converted and scaled. I can't think of an easy fix. If we manifest AutoIt for high dpi then it would work, but all the GUI controls would break at the same time.

Edited by Jon
Link to comment
Share on other sites

Aha! Yep, just had a look at my display settings, you are right.

If I drag it back to the left of the display setting everything on the screen is so small lol but if I run my mouse position script above it now gives me my correct screen resolution if I put my mouse in the bottom-right corner.

Hmm, ok, so looks like I'm stuck.

Link to comment
Share on other sites

I'm not familiar with how to do that Bert?
I looked through the info that auinfo provided but there is no information change when the button becomes active so the colour change was the best option I could see.

That being said, the button is out of the range for AutoIt due to my high DPI scaling, so even if I could read the change I couldn't click on the button lol.

Edited by WoodGrain
additional info
Link to comment
Share on other sites

I'm not familiar with how to do that Bert?
I looked through the info that auinfo provided but there is no information change when the button becomes active so the colour change was the best option I could see.

That being said, the button is out of the range for AutoIt due to my high DPI scaling, so even if I could read the change I couldn't click on the button lol.

Is it not something you could activate using ControlSend rather than clicking ?

Link to comment
Share on other sites

check with the iuiAutomation thread in examples section and try if simplespy can reach your control (logically it should as its using the uiautomationcore.dll)

most likely the iuiAutomation stuff will have a property of the control if its active yes/no and as such no need to check based on the color.

 

Link to comment
Share on other sites

I'm not familiar with how to do that Bert?
I looked through the info that auinfo provided but there is no information change when the button becomes active so the colour change was the best option I could see.

That being said, the button is out of the range for AutoIt due to my high DPI scaling, so even if I could read the change I couldn't click on the button lol.

junkew is right on point

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...