Sign in to follow this  
Followers 0
Newscritpz

Mouseclick & different resolutions

9 posts in this topic

Hi I'm using this formula to adapt my mouseclick based script (controlclick doesn't work) to different resolutions:

;(<screen x position> / <screen x dimension>) * 100 = %
 
$pctX = (< x coords of the pixel to be clicked >/$desktopwidth)*100 
$pctY = (< y coords... > /$desktopheight)*100
 
MouseClick("left",($pctX * $desktopwidth)/100, ($pctY * $desktopheight)/100, 1, 0)
 
 
But this method can be used only with monitors with the same ratio of mine ( 16:9 ), if I try for example with a 16:10 or 5:4
the coords don't match.
How can I modify the formula to let it work on different monitors?

Share this post


Link to post
Share on other sites



I have seen a "formula" on the forums, just don't know where try a search.

However there are usually easier ways, a pixel is a pixel whatever the screen resolution, so using MouseCoordMode will usually fix the problem.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Sorry I didn't explain the problem very well because of my english...

The pixels I want to click are in some windows which are automaticaly resized to fit in the screen.

So even if I use relative/client mouseclick mode it doesn't work because the windows are adapted to the different resolution and the coordinates change.

The method I posted before works with different resolutions, but only if the aspect ratio is the one I'm using on my monitor (16:9).

Share this post


Link to post
Share on other sites

can you use controlclick?

Read first line of OP :whistle:



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

There's no way to solve my problem? :(

Share this post


Link to post
Share on other sites

Dim $xMove = @DesktopWidth

Dim $yMove = @DesktopHeight

MouseMove((<coordinate % in decimal form> * $xMove), (<coordinate % in decimal form> * $yMove), 0)

-----

This is what I usually use.


If you need help with your stuff, feel free to get me on my Skype.

I often get bored and enjoy helping with projects.

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