=sinister= Posted September 13, 2006 Share Posted September 13, 2006 (edited) I made a function to convert x and y positions to different resolutions. My mom helped me with the equation so i don't know if it will work exactly. I keep getting decimals, so you might need to roud or take off the decimals along with the numbers. Tell me what ya think. It grabs the resolution of the current window and converts your x and y position. There were 2 different equations, so there are 2 different UDF's. Func ConvertX($Number) $Resolution = WinGetClientSize("") $PosX = $Number * $Resolution[0]/800 Return $PosX EndFunc Func ConvertY($Number) $Resolution = WinGetClientSize("") $PosY = $Number * $Resolution[1]/600 Return $PosY EndFunc Hope ya like it. --Edit-- Forgot to tell you the smallest Resolution it works with is 800x600! Edited September 13, 2006 by =sinister= Link to comment Share on other sites More sharing options...
erifash Posted September 13, 2006 Share Posted September 13, 2006 (edited) From this topic:; converts coords (x,y) in (a,b ) screen resolution to (c,d) screen resolution Func _ConvertCoords( $x, $y, $a, $b, $c = @DesktopWidth, $d = @DesktopHeight ) Local $ret[2] = [( $c * $x ) / $a, ( $d * $y ) / $b] Return $ret EndFuncHope it helps! Edited September 13, 2006 by erifash My UDFs:_FilePrint() | _ProcessGetName() | _Degree() and _Radian()My Scripts:Drive Lock - Computer Lock Using a Flash DriveAU3Chat - Simple Multiuser TCP ChatroomStringChunk - Split a String Into Equal PartsAutoProxy - Custom Webserver Link to comment Share on other sites More sharing options...
=sinister= Posted September 14, 2006 Author Share Posted September 14, 2006 I tried yours, and I still get decimals. I think rouding may help? Any ideas? Link to comment Share on other sites More sharing options...
jvanegmond Posted September 14, 2006 Share Posted September 14, 2006 That's no theory. That's basic(!) math. github.com/jvanegmond Link to comment Share on other sites More sharing options...
sohfeyr Posted September 15, 2006 Share Posted September 15, 2006 I tried yours, and I still get decimals. I think rouding may help? Any ideas?Try the help file. AutoIt has a Round() function. Mine:Time Functions - Manipulate the system clock! | WinControlList (WinGetClassList++) | .Net Setup Wrapper, Detect or install .Net | Writing and using a VB .NET COM object in AutoItNot mine, but highly recommended:AutoItTreeViewExtension plugin | Menu code | Callback helper dll | Auto3Lib - Control the uncontrollable | Creating COM objects in AutoIt | Using .Net framework classes in AutoIt Link to comment Share on other sites More sharing options...
Richard Robertson Posted September 15, 2006 Share Posted September 15, 2006 Int($x), Int($y) will return only the integer portions of the numbers. This is a simple way to get integers. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now