Jump to content

Calculate checkbox position


Recommended Posts

Good morning, i am in the process of automating a very repatitve task that is basically nothing but a bunch of mouse clicks and copy and paste's. However in one particular window, i cannot "tab" to the field i need to select, it is also an application that autoIT's window info wont return any information on besides window title and mouse position (encompix). SO...i figured since this particular field is always in the same position in the window, depending on the size and position of the window (multiple users will be using this) i can calculate the position of the field. however i suck at math so i cannot remember how to calculate the coordinates. Here are some sample coordinates if you would like to help. Window position -831x 39y, and window size is 731w x 510h, with this the position of the field i want to simulate a mouse click on -573x, 367y. Any help will be met with gratuitous praise and thanks!

Link to comment
Share on other sites

I'd suggest changing the MouseCoordMode:

AutoItSetOption("MouseCoordMode", 2)

that makes all x,y coords relative to the client of the active window (make sure your expected window is active).

If not using that option, use WinGetPos, and take out the X,Y, and then figure it out from there

edit: you can get the x,y coord relative to the client of the active window through the autoitinfo tool

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

You'll probably run into issues with users who have different screen resolutions.

I don't beleive GUI's are redrawn exactly to scale when changing resolution, so you'll find some attempted button clicks will come out as misses. I think you'll either need to store separate location values for each resolution for each control, or switch to Send()ing characters to navigate around the window.

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...