Jump to content

MouseClick Co-Ordinates multiplication


Recommended Posts

Hi, I'm trying to multiply the co-ordintes inside my Mouseclick() function so that i can use my script on many resolutions.

Currently its configured for 1280x1024, but was hoping to use the following code to adjust it.

CODE
$height = IniRead($inilocation, "resoltion", "height", "NotFound")

$width = IniRead($inilocation, "resoltuion", "width", "NotFound")

;Set up resoltuion changes

$h = ($height/1280)

$w = ($width/1024)

Then use something like

CODE
MouseClickDrag("left", 1028 * $h, 333 * $w, 1028 * $h, 710 * $w)

MouseClick("left", 612 * $h, 712 * $w)

but currently as a bit stuck as it is not working.

Thanks in advance

Link to comment
Share on other sites

Below sample code works

I am not sure but it could be that the arguments should be rounded to integers

$top=1280
$left=1024

;Initial settings
$height=1280
$width=1024

;Set up resoltuion changes
$h = ($height/1280)
$w = ($width/1024)

$top = $h * $top
$left= $w * $left
mousemove($top,$left)

;second settings
$height=800
$width=600

;Set up resoltuion changes
$h = ($height/1280)
$w = ($width/1024)

$top = $h * $top
$left= $w * $left
mousemove($top,$left)
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...