Jump to content

Same Location On All Resolutions.


Recommended Posts

maybe...

If @DesktopWidth = 800 and @DesktopHeight = 640 Then
; do this
ElseIf  @DesktopWidth = 1024  and @DesktopHeight = 768 Then
; do this
Else
    MsgBox(64, "Sorry", "Your Screen Resolution is non-compatable with this program  ")
EndIf

8)

NEWHeader1.png

Link to comment
Share on other sites

Yeah, I already have that currently implemented but what if they use a resolution that my moniter doesn't support or they use this program with a resolution that is just really weird?

Link to comment
Share on other sites

Yeah, I already have that currently implemented but what if they use a resolution that my moniter doesn't support or they use this program with a resolution that is just really weird?

notice the last line???

Else
    MsgBox(64, "Sorry", "Your Screen Resolution is non-compatable with this program  ")

8)

NEWHeader1.png

Link to comment
Share on other sites

he wants to always click the correct button/area, no matter what screen resolution the user is on.

1 .- try to get the button name with AutoIt Window Info an then use the Function ControlClick

or

2.-

Func ClickRelative($x, $y)
    $Deltax = @DesktopWidth/1000
    $Deltay = @DesktopHeight/1000
    MouseClick("main", $x*$Deltax, $y*$Deltay)
EndFunc

Call this function with $x and $y between 0 and 1000

Edited by GioVit
Link to comment
Share on other sites

  • Moderators

Why not just use the Window or Client area/coords of the window you want to click to avoid a resolution issue?

Edit:

Typo

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

i am having the same problem too.

I run scripts recorded with AutoIT recorder. I got the coordinates on the desktop computer with 1024X768 resolution, then when I run it on my notebook with the same resolution, the mouse click is off the mark.

I suppose there is a smarter way of getting the mouseclick orientated on different pc/resolution?

Link to comment
Share on other sites

I suppose there is a smarter way of getting the mouseclick orientated on different pc/resolution?

Welcome ultor,

Like as SmOke_N has stated. Use the client area of the active window.

Use at the top of your script:

Opt("MouseCoordMode", 2)

and use AutoIt Info Tool with the setting in Options -> Coord Mode -> Client. Now change the MouseClicks within your script to the information that AutoIt Info Tool returns with new Coordinates within the active window.

Or as CyberSlug is perhaps suggesting, use Control* functions if possible, to directly interact with controls.

:)

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...