Sign in to follow this  
Followers 0
UnknownWarrior

Math Alorgithm for Coordinates (MouseClick)

7 posts in this topic

#1 ·  Posted (edited)

So a buddy of mine wanted me to automate a program he uses to mine data with. This process takes roughly 1 hour to do, so I told him I could automate it for him. So I went and recorded all the mouseclick coordinates ("MouseCoordMode", 0) and sent it to him.

Now that I'm looking at the program on his screen through TeamViewer, I noticed his program is 35 coordinates shorter on the y-axis. My dimensions of the program are:

883, 757

His are:

883, 722

I know there is a way to mathematically adjust this so I don't have to re-record this entire thing -- but I just can't come up with it. Can anyone provide me with some insight? :(

My brief thought (which shows my lack of math knowledge haha) was to simply add 35 to every coordinate... well, that wouldn't make sense because with MouseCoordMode, 0, the top left is 0,0 on both our screens. It progressively becomes more of a difference as the y-axis goes down... finally landing on a 35 difference at the bottom of the screen.

Thanks!

P.S. - Resolution has no factor on it. For whatever reason, when I load the program and he loads the program, the buttons are in different spots (but are always at the same spots on any resolution beings I used MouseCoordMode 0). The screen stays the same width/height for all resolutions.

EDIT (Can be deleted):

Found the solution:

MouseMove($click[1], Round(($click[2] / 757) * 722), 0)

Edited by UnknownWarrior

Share this post


Link to post
Share on other sites



Did ya try controlclick()


----------------------------------------

:bye: Hey there, was I helpful?

----------------------------------------

My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1

Share this post


Link to post
Share on other sites

Can't get the ControlID of Menu items at the top of the program :(.

However -- the algorithm didn't quite work as planned... it's still off. For whatever reason, it works in some spots, but in others it's completely off. Does anyone see why?

Share this post


Link to post
Share on other sites

At least this should work:

$WINDOWTITLE =
$CONTROLTEXT =
ControlClick("" & $WINDOWTITLE, "", "[TEXT:" & $CONTROLTEXT & "]")

----------------------------------------

:bye: Hey there, was I helpful?

----------------------------------------

My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1

Share this post


Link to post
Share on other sites

So @y = 722 yours @y = 757.

So try this.

722 / 757 = 1.048476454293629

So to convert from his co-ordinates to your co-ordinates you do this: $your_y_coordinate = $his_y_coordinate * 1.048476454293629

Savvy?


ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search

Share this post


Link to post
Share on other sites

P.S. - Resolution has no factor on it.

Are you sure resolution doesn't have everything to do with it?

If you were stretching a single entity, like an image, across different desktops then you could use a single formula to proportionally place the cursor and poke Mona Lisa in the eye every time. But when Windows is individually drawing dozens or hundreds of separate controls at different resolutions, using different fonts and spacings, there is no guarantee that a control 20% from the top and 20% from the left at 1440x900 will be exactly 20% from the edge at 1280x1024. You need to reference the controls directly, or if that is not possible, store arrays of coordinates for each accessed control and each supported resolution.

Share this post


Link to post
Share on other sites

After fiddling with it for a long ass time, and taking all of this into consideration... I came across something that I haven't tried yet and was hoping someone would have some experience on them:

1. COM Object Automation

-- Researched this and the only thing I don't quite understand would be how to get the Object of all sorts of buttons on my program?

2. Win API

-- Didn't look too much into this, but I think this is another solution to automate any windows program?

3. Injecting DLL/Hooking

-- This seemed the most promising - but also the most difficult. I understood slightly what was going on in the HelpFile, but I didn't really understand how to send my own events as if the program were doing it. Let's take Calculator for instance:

-How would I send the keys 1 + 2 and press equal? (and get the result?)

-How would I go: Help -> View Help ?

If anyone has any experience in automating other software, your input would be greatly appreciated!

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