Sign in to follow this  
Followers 0
ganon64

$hor and $vert strange formula

3 posts in this topic

Ok i understand the code but not the equations in bold that make it work, basically i am trying to get a program to click on a button no matter what the resolution the screen is in. Now this is something someone else coded where it works using the equations in bold but only for where they want to click. I wanna mainipulate the equations and use em for coordinates of my choice

$size = WinGetPos("Program")

$WepPixel=$size[2]-26

if PixelGetColor($WepPixel,224) = 0 Then

Send("{x}")

EndIf

$HammerHor=($size[2]-306)/2+107

$HammerVer=($size[3]-146)/2+112

if PixelGetColor($HammerHor,$HammerVer) = 16710616 Then

mouseclick("left",$HammerHor,$HammerVer,1)

EndIf

if PixelGetColor($WepPixel,224) = 0 Then

$ExitHor=$size[2]/2

$ExitVer=($size[3]-210)/2+172

Share this post


Link to post
Share on other sites



I would think if you set the mouse and pixel coordinate modes to window client area instead of desktop, the math wouldn't be necessary:

Opt("MouseCoordMode", 2)
Opt("PixelCoordMode", 2)

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I would think if you set the mouse and pixel coordinate modes to window client area instead of desktop, the math wouldn't be necessary:

Opt("MouseCoordMode", 2)
Opt("PixelCoordMode", 2)

:)

tried this and it never worked for some reason anyway i solved them equations basically

x = 0.5*xres + c

where c = x(coord in that res) - (res/2)

and the same with y

y = 0.5*yres + c

where c = y(coord in that res) - (res/2)

not tested it yet but it should work in theory to click on a button or wtever in every res once you've measured the coords in one res

Hence you'd program

$size = WinGetPos("Program")
$xpos = ((0.5*$size[2]) + (("Measured X Coord in a res") - $size[2]/2)
$ypos = ((0.5*$size[3]) + (("Measured  Y Coord in a res") - $size[3]/2)

MouseClick("left","$xpos,$ypos,1,0)
Edited by ganon64

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