WoodGrain

AUInfo Reading info under mouse on 2560x1440 screen wrong

22 posts in this topic

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!

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Toshiba Kira :)

idk, I've not used those before, I'll throw a script together over the w/e & get back to you

Share this post


Link to post
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

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

Anyone have any suggestions?

Share this post


Link to post
Share on other sites

Thanks junkew, tried that but the area I'm looking at is a gradient, so I'd need to grab the pixel location as well, if autoit can't read the pixel location then when I run my script it will probably be out too :(

Share this post


Link to post
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

Share this post


Link to post
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)

 

Share this post


Link to post
Share on other sites

Of course the colour may be completely wrong because of the screen resolution, in which case I could probably try doubling the pixel location..

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

This might also return some interesting info:

Sleep(3000)
$locationX = MouseGetPos(0)
$locationY = MouseGetPos(1)
$msg = $locationX & "," & $locationY
ClipPut($msg)
MsgBox(0,"x,y", $msg)

 

Edited by WoodGrain

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

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

Share this post


Link to post
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 ?

Share this post


Link to post
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.

 

1 person likes this

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Thanks guys! I'll check it out.

In the mean time since Jon identified the culprit as DPI scaling I'm going to drop my resolution by 1/2 and reduce the DPI scaling which should move the button to a locatable and clickable area on the screen :).

Share this post


Link to post
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

  • Similar Content

    • Tarakesh
      By Tarakesh
      I have a situation where the desktop is designed in java swings. The nodes JTree is not allowing me to do checkbox selection using "spacebar". I am able to navigate through the nodes using up, down arrow and a tab. When I reach to the desire node selection, mouse left click is not working due a flaw a JTree core. However since it is selected, if mouse cursor auto moved to the position of the selection and send a "click"  then it should be solved. Any ideas much appreciated. 
      the problem with having fixed coordinates are the main windows is divided to 2panels where right panel containing this JTree can be expanded or shrink-ed.

    • perlabsrat
      By perlabsrat
      Hello, I have a Logitech MX500 mouse, this has 7 buttons plus a wheel.
      I am trying to figure out how to detect clicks on three of the buttons on this mouse but have been unable to do so. I am not running any Logitech software just the standard Windows 7 driver. The buttons are all working fine but when I try to figure out which button was clicked unable to detect three of the buttons.

      Using this code snippet I am able to see all the button presses with the exception of these three marked by '?'.
      Is there some alternate method for detecting button clicks? I have been searching for example but have yet to find anything.
      Thanks...
       
      #include <Misc.au3> Dim $a While 1 For $a = 1 To 100 If _IsPressed($a) Then ConsoleWrite("you pressed " & $a & @CRLF) Next WEnd
    • Nitrolord
      By Nitrolord
      I had this problem with PixelGetColor not giving me the same HEX Color as the AU3Info Tool and searched every were with no luck then had a OH DA moment LoL.
      The problem is that the
      "PixelGetColor ($mouseX[0], $mouseY[1])"
      is looking rite at the very tip of the mouse pointer not under it.  So you have to set a -3 after the [0] and [1].  
      "PixelGetColor ($mouseX[0] -3, $mouseY[1] -3)"
      to make it search next to the pointer not on the pointer.  You may have to adjust this a bit for your display but you should not have  to go more then -5.  -3 seems to work best for me.
      Example.au3
      #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 141, 127, 276, 231) $Input1 = GUICtrlCreateInput("", 8, 8, 121, 21) $Label1 = GUICtrlCreateLabel("Press or Hold F1 to get Hex color at Mouse X -3, Y-3 Pos,", 8, 40, 124, 73) GUISetState(@SW_SHOW) HotKeySet("{f1}","MousePos") Func MousePos() $aPos = MouseGetPos() $PGC = PixelGetColor($aPos[0] -3, $aPos[1] -3) GUICtrlSetData($Input1, "0x" & Hex($PGC, 6)) EndFunc While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd  
    • Miliardsto
      By Miliardsto
      Hello i have problem with function PixelGetColor. On my computer it working fine but in some cases it not working.
      And Im clicking on the active window on red color and it give me the same color still. But in other computers when clicking on the same color red it gives other values and returned color in MsgBox is not red.
      Dont know is it a real main thing what causing problem but,
      I noticed that problem was on one windows 10.
      I have windows 8 and working well. On other windows 10 works well to
      Maybe it is caused by windows aero or something like that
      How to deal with it?
      There is a code
      HotKeySet("{PAUSE}", "MouseCord") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func MouseCord() Global $MousePos = MouseGetPos() $clickedColor = PixelGetColor($MousePos[0], $MousePos[1]) MsgBox(0, "Done", $clickedColor) EndFunc  
       
    • ashly
      By ashly
      i'm trying to use _ScreenCapture_Capture($sFileName) to cature full screen and save as a jpg file, but it always only capture the left-top about 3/4 area.
      but the print screen keyboard woks fine.
      and if i changed the display resolution from 150% to 100%, the jpg file is OK as well.
      so the issue only occurred when resolution is 150%.
      is there anybody know why or how to change resolution percentage by scripts?
      Thanks.