Jump to content

mousecoordmode questions


Recommended Posts

i am trying to get my mouse to Go to X,Y of a certain Client

somethign like

ControlClick("Game", "", "[CLASS:MacromediaFlashPlayerActiveX; INSTANCE:1]", "left", 1, 20, 31)

i don't want it to click.. just move there

was wondering if MouseCoordMode would be able to do something, cuz im not sure what it does...

if i did

Opt("MouseCoordMode", 2) ;1=absolute, 0=relative, 2=client

would MouseCLick (XXXXXXXX) be same as ControlClick(XXXXXX)

Link to comment
Share on other sites

Not sure exactly what you're looking to do... But if you are trying to move your mouse (without clicking) to a set of coordinates try:

MouseMove ( x, y [, speed] ) -- Details in the help file...

The MouseCoordMode option simply defines the "relative location" of the X,Y coordinates... -- Info from the help file below...

Sets the way coords are used in the mouse functions, either absolute coords or coords relative to the current active window:

0 = relative coords to the active window

1 = absolute screen coordinates (default)

2 = relative coords to the client area of the active window

Link to comment
Share on other sites

Not sure exactly what you're looking to do... But if you are trying to move your mouse (without clicking) to a set of coordinates try:

MouseMove ( x, y [, speed] ) -- Details in the help file...

The MouseCoordMode option simply defines the "relative location" of the X,Y coordinates... -- Info from the help file below...

Sets the way coords are used in the mouse functions, either absolute coords or coords relative to the current active window:

0 = relative coords to the active window

1 = absolute screen coordinates (default)

2 = relative coords to the client area of the active window

that's what im trying to do... i am trying to move my mouse without clicking it to a relative coord of my client area of the active window... Mousemove (XXX) moves it only to coords of my screen

Link to comment
Share on other sites

that's what im trying to do... i am trying to move my mouse without clicking it to a relative coord of my client area of the active window... Mousemove (XXX) moves it only to coords of my screen

There are different ways for the mouse coordinates to work and if you don't want absolute screen coordinates then you have to set it to the way you want using

AutoItSetOption("MouseCoordMode",MODE)

where MODE is 0,1 or 2 as explained in the earlier post and in the help.

For 0 and 2 the coordinates are relative to the active window. So if you do this

AutoItSetOption("MouseCoordMode",2);stays this way fo rthe rest of the script or until you change it again

MouseMove(10,10,0)

then the mouse cursor will move fast to 10 pixels in and 10 pixels down from the top left corner of the client area in the currently active window.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

There are different ways for the mouse coordinates to work and if you don't want absolute screen coordinates then you have to set it to the way you want using

AutoItSetOption("MouseCoordMode",MODE)

where MODE is 0,1 or 2 as explained in the earlier post and in the help.

For 0 and 2 the coordinates are relative to the active window. So if you do this

AutoItSetOption("MouseCoordMode",2);stays this way fo rthe rest of the script or until you change it again

MouseMove(10,10,0)

then the mouse cursor will move fast to 10 pixels in and 10 pixels down from the top left corner of the client area in the currently active window.

thx :D

does it move to the first client in the active window it sees? or the Farthest one inside?

cuz i have a window then a client inside another client..

Link to comment
Share on other sites

thx :D

does it move to the first client in the active window it sees? or the Farthest one inside?

cuz i have a window then a client inside another client..

I don't know though I probably should. I assume you mean your window has child windows. Why don't you try it, see what happens, then you can tell me? I'll be waiting ... :D
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

I don't know though I probably should. I assume you mean your window has child windows. Why don't you try it, see what happens, then you can tell me? I'll be waiting ... :D

yes.. this only moves to the FIRST instance that it sees... the most outlying Client... = \

any way to make it move to the client i want?

Link to comment
Share on other sites

yes.. this only moves to the FIRST instance that it sees... the most outlying Client... = \

any way to make it move to the client i want?

OK. I think what has to be done is to find the position of the child window you want and then take the next step. So is it a child window you are trying to deal with, and has it got a title you can identify it with?

If so then you can find the handle of the child window using EnumChildWIndows and then you can find it's position using WinGetPos.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

OK. I think what has to be done is to find the position of the child window you want and then take the next step. So is it a child window you are trying to deal with, and has it got a title you can identify it with?

If so then you can find the handle of the child window using EnumChildWIndows and then you can find it's position using WinGetPos.

@DNnlee

In a PM to me you asked about EnumChildWinds, and told me you are using Firefox . Firefox is an example of a window that's not so easy to deal with.

The information on EnumChildWindows is here.

First of all, here is a script I've made so that you can find the child windows in any window. If you play with it you will see that even windows you wouldn't think have Children might have lots of them. This script is just a modification to the example in the help file for EnumWIndows.

#include <misc.au3>
Opt("mustdeclarevars", 1)
Global $x = 0, $wincount = 0, $viscount = 0, $parentWindow, $hPWnd, $handle, $ParentTitle, $type

; Create callback function
$handle = DllCallbackRegister("_EnumChildWindowsProc", "int", "hwnd;lparam")

ToolTip("click on the window you want to find child windows for", 0, 0)
While Not _IsPressed("01") 
    ToolTip("click on the window you want to find child windows for", $x, $x)
    Sleep(60)
    $x += 1
    If $x > @DesktopHeight - 20 Then $x = 0
WEnd
ToolTip("")

;get the title of the window we want
$ParentTitle = WinGetTitle("[active]")
If IsInt($ParentTitle) Then Exit

$hPWnd = WinGetHandle($ParentTitle)

$type = MsgBox(4, "Search for Visible children", "Do you want to ignore child windows with no title?")
; Call EnumWindows
DllCall("user32.dll", "int", "EnumChildWindows", "hwnd", $hPWnd, "ptr", DllCallbackGetPtr($handle), "lparam", $type)

; Delete callback function
DllCallbackFree($handle)

If $wincount = 0 Then
    If $viscount Then
        MsgBox(0, $parentWindow & " child windows", $viscount & " visible " & @CRLF & " 0 with titles")
    Else
        MsgBox(0, "ERROR", '"' & $ParentTitle & '"' & " has no children")
    EndIf
EndIf

; Callback Procedure
Func _EnumChildWindowsProc($hWnd, $lParam)
    Local $pp, $res
;only include visible windows with titles
    If BitAND(WinGetState($hWnd), 2) Then
        $viscount += 1
        If WinGetTitle($hWnd) <> "" Or $lParam <> 6 Then
            $pp = WinGetPos($hWnd)
            $wincount += 1
            $res = MsgBox(1, WinGetTitle($hWnd), "$hWnd=" & $hWnd & @CRLF & "lParam=" & $lParam & @CRLF & "$hWnd(type)=" & VarGetType($hWnd) _
                     & @CRLF & $pp[0] & ', ' & $pp[1])
            If $res = 2 Then Return 0; Cancel clicked, return 0 to stop enumeration
        EndIf
    EndIf
    Return 1; Return 1 to continue enumeration
EndFunc  ;==>_EnumChildWindowsProc

I think you will find that the area in Firefox that you are interested in has no title. Without a title it's very difficult to know which window is the one you're interested in, or even if what you want is a standard window. If what you want has a title then you can get it's position with WinGetPos($ChildHandle). You have to use the handle because the title will only work for parent windows (I'm fairly sure that's correct.)

So I think the best thing to do will be

1) use winmove to set Firefox to a particular position and size, maybe 0,0 and 800x600

2) use absolute screen coordinates for all your mouse moves and clicks.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...