Sign in to follow this  
Followers 0
JasonTHEchristian

Calculate checkbox position

7 posts in this topic

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!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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.

Share this post


Link to post
Share on other sites

I'll try that, thanks for the super fast response YOU ROCK!

Share this post


Link to post
Share on other sites

YES! it worked! THANK YOU SO MUCH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Share this post


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

Share this post


Link to post
Share on other sites

I couldnt send character's to navigate, this particular field is only "activated" by a mouse click for whatever reason, but thats a good point about different screen resolutions, i imagine that i could get the window size and then calculate the x,y position from that. Thanks for that point!

Share this post


Link to post
Share on other sites

This thread is similar to yours:

1 person likes this

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
Sign in to follow this  
Followers 0