Jump to content

Window Coordinants Different, One Monitor To Another


Recommended Posts

I have the job of automating an application with quite a number of features/buttons. Because I have learned that the developer changes the GUI around, instead of hard-coding the coordinants for a particular button, I have written functions for each button, and include it as a separate au3 file.

The problem I have run into, however, is that for some reason, the coordinants of a button slightly change from one computer/monitor to another. One of my coworkers wrote functions for one page of buttons, which worked on his computer, but when I tried it on mine, some clicks were off by about 10 pixels or so. We were running the same theme, same OS, same version, used the Opt("MouseCoordMode",0) option, even the same *monitor*... in other words we did our homework. Why would this be?

We have thought of maybe using controlclicks instead of mouseclicks, but the developer also changes the control ids as well. Furthermore, if the script only uses control ids, it is hard to pinpoint what the script is doing at any given time, since the mouse wouldn't be moving. This might prove difficult to troubleshoot when something breaks the script.

So why the coordinant changes, and what would be the best way of handling this "GUI-changing" problem?

Any thoughts?

Edited by laphlaw
Link to comment
Share on other sites

Why would you use Opt("MouseCoordMode",2)? What's the difference, anyway? If it is better to use '2', then how would I make it so that when using the AU3Record utility, it records those coordinants, instead of the default Opt("MouseCoordMode",0)?

Any other thoughts/help? I am really stuck on this!

Link to comment
Share on other sites

Why would you use Opt("MouseCoordMode",2)? What's the difference, anyway? If it is better to use '2', then how would I make it so that when using the AU3Record utility, it records those coordinants, instead of the default Opt("MouseCoordMode",0)?

Can't answer the second question about the AU3Record utility. But the first answer is, 2 is always better if you are using the AutoIt Window Info tool. By setting the Coord mode of the utility to client you can be precise. However this does not answer the specific question about the AU3Record Utility, but I do not use that too frequently. Sorry I can't help more.

"I have discovered that all human evil comes from this, man's being unable to sit still in a room. " - Blaise Pascal
Link to comment
Share on other sites

Can't answer the second question about the AU3Record utility. But the first answer is, 2 is always better if you are using the AutoIt Window Info tool. By setting the Coord mode of the utility to client you can be precise. However this does not answer the specific question about the AU3Record Utility, but I do not use that too frequently. Sorry I can't help more.

My question, then, is what's the difference between window (0), and client (2)?

Is that why you think I've been having problems with the coordinants on different monitors?

Link to comment
Share on other sites

  • Moderators

My question, then, is what's the difference between window (0), and client (2)?

Is that why you think I've been having problems with the coordinants on different monitors?

MouseCoordMode Sets the way coords are used in the mouse functions, either absolute coords or coords relative to the current active window:

0 = relative coords to the active window

1 = absolute screen coordinates (default)

2 = relative coords to the client area of the active window

Use the Auto Window Info Tool (Start >> All Programs >> AuotIt v3 >> Auto Window Info >> Options >> Coord Mode >> Client.

Edit....

(0 uses the entire window (including the title bar) / 2 only uses the actual area of the window (without the title bar))

So for different window setups (example: Different XP Themes ... Classic vs XP Theme) even though it's the same OS, it would not present the same result with using "0".

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'd personally do save a screen shot (Alt+Printscreen, then paste into mspaint .exe and save as bitmap) from each computer and then compare the files....

Add: I'd also double check that both computers are running the same version of AutoIt *and* the same AutoIt sccript. That second one has bitten me in the past :think:

Edited by CyberSlug
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
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...