JohnOne Posted November 2, 2010 Posted November 2, 2010 (edited) I would expect the following code (modified from helpfile) to move the mouse to the bottom right of window client area. #include <WinAPI.au3> _Main() Func _Main() Local $hwnd, $tRect Run("notepad.exe") $hwnd = WinWaitActive("Untitled - Notepad", "") If IsHWnd($hwnd) Then $tRect = _WinAPI_GetClientRect($hwnd) MsgBox(4096, "Rect", _ "Left..: " & DllStructGetData($tRect, "Left") & @LF & _ "Right.: " & DllStructGetData($tRect, "Right") & @LF & _ "Top...: " & DllStructGetData($tRect, "Top") & @LF & _ "Bottom: " & DllStructGetData($tRect, "Bottom")) MouseMove(DllStructGetData($tRect, "Right"), DllStructGetData($tRect, "Bottom"), 0) Else MsgBox(0, "", "") EndIf EndFunc Except is does not, am I forgetting something? Edited November 2, 2010 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
AdmiralAlkex Posted November 2, 2010 Posted November 2, 2010 (edited) Look at the numbers from the MsgBox, is the top-left really at 0,0? Not even close. It is intentional, see the function description at MSDN. Or in the helpfile for WinGetClientSize() (same thing obviously).You have to figure out some other way to get the bottom right of client area. Edited November 2, 2010 by AdmiralAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
squid808 Posted November 2, 2010 Posted November 2, 2010 Try adding opt("MouseCoordMode",2) to the top, seems to work for me after that.
PsaltyDS Posted November 2, 2010 Posted November 2, 2010 You forgot a line: Opt("MouseCoordMode", 2) ; 2 = relative coords to the client area of the active window 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
JohnOne Posted November 2, 2010 Author Posted November 2, 2010 Thanks guys, I thought I must have been forgetting something. #include <WinAPI.au3> _Main() Func _Main() Local $hwnd, $tRect, $tpoint Run("notepad.exe") $hwnd = WinWaitActive("Untitled - Notepad", "") If IsHWnd($hwnd) Then $tRect = _WinAPI_GetClientRect($hwnd) $tpoint = DllStructCreate("int X;int Y") DllStructSetData($tpoint, "X", DllStructGetData($tRect, "Left")) DllStructSetData($tpoint, "Y", DllStructGetData($tRect, "Top")) _WinAPI_ClientToScreen ($hwnd, $tpoint) MsgBox(0,"",DllStructGetData($tpoint, "X") &"x"&DllStructGetData($tpoint, "Y")&@LF) MouseMove(DllStructGetData($tpoint, "X"), DllStructGetData($tpoint, "Y"), 0) Else MsgBox(0, "", "") EndIf EndFunc ;==>_Main AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
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