Jump to content
WoodGrain

AUInfo Reading info under mouse on 2560x1440 screen wrong

Recommended Posts

WoodGrain

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
BrewManNH

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
WoodGrain

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
BrewManNH

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
WoodGrain

@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
WoodGrain

Anyone have any suggestions?

Share this post


Link to post
Share on other sites
WoodGrain

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
junkew

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
WoodGrain

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
WoodGrain

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
WoodGrain

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
Jon

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
WoodGrain

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
WoodGrain

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
mpower

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
junkew

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.

 

  • Like 1

Share this post


Link to post
Share on other sites
Bert

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
WoodGrain

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

    • badcoder123
      By badcoder123
      Hey, all.  
      I've been looking for a way to change cursor colour but not the cursor itself. I've been looking for a couple hours now and can't find anything.  I also don't even know where to start, if anyone has any tips or examples please comment them.
      Thanks
    • tiye0405
      By tiye0405
      Hello, 
       
      I currently have a problem that deals with moving the mouse to a given location + or - a certain distance.
      $search1 =_WaitForImageSearch("envelope.bmp", 10, 1, $x, $y, 20)
      $search2 =_WaitForImageSearch("envelope2.bmp", 10, 1, $x, $y, 20)
       
      If $search1 = 1 Then
                  Sleep(100)
                  MouseMove($x, $y, 10)
                  sleep(99)
                  MouseClick("left")
                 Sleep(99)
      ElseIf $search2 = 1 Then
                 Sleep(100)
                 MouseMove($x, $y2, 10)
                 sleep(99)
                 MouseClick("left")
                 Sleep(100)
      Else
                Sleep(150)
                MouseMove($x2, $y, 10)
                Sleep(150)
                MouseClick("left")
               Sleep(150)
      EndIf
      The problem about this is that i defined $x2 = $x - 175  and $y2 = $y + 35
      I got these numbers ( 175 and 35) with the autoit helper and just subtracted point where it is to the point its supposed to move but it doesnt work.

      is there any proper way to find the distance between 2 points in pixels?
       
      Imgsearch doesnt always work for this picture so i want it to have a backup
       
      edit: could it be that the definition of $x and $y  from the previous image search arent there anymore and thats why it moves my mouse to strange places? 
      is there a way to preserve the $x $y from the previous img search untill the next succesful one?
       
       
    • TheAutomator
      By TheAutomator
      Hi!

      I'm trying to script an ellipse drawing algorithm in AutoIT for learning purposes.
      I use an edit control to "draw" the ellipse with characters.
      The code i have works kinda good but i would like to see if others around here know a better algorithm to do it..
      I would like to be able to give the x, y and width, height arguments to the function and not have to start at the middle point and draw the ellipse around it.

      side note, the ellipse glitches when it has to be 2 pixels high too..
       
      func ellipsePlotPoints ($xc,$yc, $x,$y) pixel ($xc + $x, $yc + $y) pixel ($xc - $x, $yc + $y) pixel ($xc + $x, $yc - $y) pixel ($xc - $x, $yc - $y) endfunc func ellipse($xc,$yc, $a,$b) local $a2 = $a * $a local $b2 = $b * $b local $twoa2 = 2 * $a2 local $twob2 = 2 * $b2 local $p local $x = 0 local $y = $b local $px = 0 local $py = $twoa2 * $y ; Plot the initial point in each quadrant. ellipsePlotPoints ($xc,$yc, $x,$y) ; Region 1 $p = int($b2 - ($a2 * $b) + (0.25 * $a2)) while ($px < $py) $x+=1 $px += $twob2 if ($p < 0) then $p += $b2 + $px else $y-=1 $py -= $twoa2 $p += $b2 + $px - $py endif ellipsePlotPoints ($xc,$yc, $x,$y) wend ; Region 2 $p = int ($b2 * ($x+0.5) * ($x+0.5) + $a2 * ($y-1) * ($y-1) - $a2 * $b2) while ($y > 0) $y-=1 $py -= $twoa2 if ($p > 0) then $p += $a2 - $py else $x+=1 $px += $twob2 $p += $a2 - $py + $px endif ellipsePlotPoints ($xc,$yc, $x,$y) wend endfunc  
    • 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
×