kalixe

Multiple mouse cursor

7 posts in this topic

hello,

I would like duplicate the pointing device in two windowss (the same application) running on the same system.

I mean duplicate the mouse movements and clicks into client parent on another window, to have bypass devices (two mouse cursors) even more, each dedicated to one window. This is very technical and very complicated to implement for my part, but may be some of the tracks.

The question "very difficult to do" is : How to simulate multiple pointing devices through a single mouse, even the same movements and clicks, only the coordinates of each change, by offering windows.

For example, I have 2 notepad application, when I put my mouse on one, a mouse cursor appears on the second and do the same things than the one.

Anybody knows ?

Share this post


Link to post
Share on other sites



hello,

I would like duplicate the pointing device in two windowss (the same application) running on the same system.

I mean duplicate the mouse movements and clicks into client parent on another window, to have bypass devices (two mouse cursors) even more, each dedicated to one window. This is very technical and very complicated to implement for my part, but may be some of the tracks.

The question "very difficult to do" is : How to simulate multiple pointing devices through a single mouse, even the same movements and clicks, only the coordinates of each change, by offering windows.

For example, I have 2 notepad application, when I put my mouse on one, a mouse cursor appears on the second and do the same things than the one.

Anybody knows ?

If it is not multitouch then it can have the illusion of being simultanious.

Simply set up a program to capture mouse input within one window, and use mouseclick(x,y,0) to set a zero delay click. Then set something to return the mouse to it's original position. This will create the illusion of the program working like you want it to.

If you must you can even set up a graphic to follow the mouse on the duplicated window.

Share this post


Link to post
Share on other sites

If it is not multitouch then it can have the illusion of being simultanious.

Simply set up a program to capture mouse input within one window, and use mouseclick(x,y,0) to set a zero delay click. Then set something to return the mouse to it's original position. This will create the illusion of the program working like you want it to.

If you must you can even set up a graphic to follow the mouse on the duplicated window.

I tried yet and despite the zero delay, the result is awful ! It's not What I want.

Share this post


Link to post
Share on other sites

HotKeySet("{ESC}", "_exit")
HotKeySet("{F10}", "_secondMouse")
$mouse = MouseGetPos()
$dll = DllOpen("user32.dll")
$toggle = 0
#include <Misc.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
$MiceX2 = GUICreate("MiceX2", 184, 92, 192, 124)
$xDistanceInput = GUICtrlCreateInput("200", 128, 0, 49, 21)
$xInfoLabel = GUICtrlCreateLabel("X Distance from Mouse", 8, 4, 114, 17)
$yInfoLabel = GUICtrlCreateLabel("Y Distance from Mouse", 8, 28, 114, 17)
$yDistanceInput = GUICtrlCreateInput("0", 128, 24, 49, 21)
$hotkeyInfo1 = GUICtrlCreateLabel("Start = F10", 16, 48, 83, 17)
$hotkeyInfo1 = GUICtrlCreateLabel("Stop = F9", 16, 64, 83, 17)
$hotkeyInfo2 = GUICtrlCreateLabel("Exit = ESC", 16, 78, 54, 17)
GUISetState(@SW_SHOW)
Opt("GUIOnEventMode", 1) ; Change to OnEvent mode
GUISetOnEvent($GUI_EVENT_CLOSE, "_exit")
_load()
While 1
    Sleep(100)
WEnd

Func _secondMouse()
    While 1
        Sleep(25)
        $mouse = MouseGetPos()
        ToolTip("^", $mouse[0] + GUICtrlRead($xDistanceInput) - 10, $mouse[1] + GUICtrlRead($yDistanceInput))
        If _IsPressed("01", $dll) Then _mouseClick()
        If _IsPressed("1B", $dll) Then
            _save()
            Exit
        EndIf
        If _IsPressed("78", $dll) Then
            ToolTip("")
            ExitLoop
        EndIf
    WEnd
EndFunc   ;==>_secondMouse



Func _mouseClick()
    ToolTip("")
    MouseUp("left")
    MouseMove($mouse[0] + GUICtrlRead($xDistanceInput), $mouse[1] + GUICtrlRead($yDistanceInput), 0)
    MouseDown("left")
    Sleep(50)
    MouseUp("left")
    MouseMove($mouse[0], $mouse[1], 0)
    ToolTip("^", $mouse[0] + GUICtrlRead($xDistanceInput), $mouse[1] + GUICtrlRead($yDistanceInput))

EndFunc   ;==>_mouseClick



Func _exit()
    DllClose($dll)
    _save()
    Exit
EndFunc   ;==>_exit

Func _save()
    IniWrite(@ScriptDir & "\MouseX2.ini", "Distance", "X", GUICtrlRead($xDistanceInput, 1))
    IniWrite(@ScriptDir & "\MouseX2.ini", "Distance", "Y", GUICtrlRead($yDistanceInput, 1))
EndFunc   ;==>_save

Func _load()
    GUICtrlSetData($xDistanceInput, IniRead(@ScriptDir & "\MouseX2.ini", "Distance", "X", "200"))
    GUICtrlSetData($yDistanceInput, IniRead(@ScriptDir & "\MouseX2.ini", "Distance", "Y", "0"))
EndFunc   ;==>_load

Tested it on two windows of Paint, and it works well

2 people like this

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

good work !

But it's not a true mouse, just a tootip and a move mouse when I click.

Look this video and look at the different windows each with their own mouse, even the passage of various mouse over objects they can move highlight or change the icon of mouse cursor.

I think that each mouse are part of a window and I think the software must use DirectX to simulate the mouse in different windows, I do not know anything about DirectX anyone knows how to use it to simulate several mouse cursor ?

I found something interesting about DirectX with AutoIt:

http://www.autoitscript.com/forum/index.php?showtopic=109185

Someone has already use?

Edited by kalixe

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

 

 

HotKeySet("{ESC}", "_exit")
HotKeySet("{F10}", "_secondMouse")
$mouse = MouseGetPos()
$dll = DllOpen("user32.dll")
$toggle = 0
#include <Misc.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
$MiceX2 = GUICreate("MiceX2", 184, 92, 192, 124)
$xDistanceInput = GUICtrlCreateInput("200", 128, 0, 49, 21)
$xInfoLabel = GUICtrlCreateLabel("X Distance from Mouse", 8, 4, 114, 17)
$yInfoLabel = GUICtrlCreateLabel("Y Distance from Mouse", 8, 28, 114, 17)
$yDistanceInput = GUICtrlCreateInput("0", 128, 24, 49, 21)
$hotkeyInfo1 = GUICtrlCreateLabel("Start = F10", 16, 48, 83, 17)
$hotkeyInfo1 = GUICtrlCreateLabel("Stop = F9", 16, 64, 83, 17)
$hotkeyInfo2 = GUICtrlCreateLabel("Exit = ESC", 16, 78, 54, 17)
GUISetState(@SW_SHOW)
Opt("GUIOnEventMode", 1) ; Change to OnEvent mode
GUISetOnEvent($GUI_EVENT_CLOSE, "_exit")
_load()
While 1
    Sleep(100)
WEnd

Func _secondMouse()
    While 1
        Sleep(25)
        $mouse = MouseGetPos()
        ToolTip("^", $mouse[0] + GUICtrlRead($xDistanceInput) - 10, $mouse[1] + GUICtrlRead($yDistanceInput))
        If _IsPressed("01", $dll) Then _mouseClick()
        If _IsPressed("1B", $dll) Then
            _save()
            Exit
        EndIf
        If _IsPressed("78", $dll) Then
            ToolTip("")
            ExitLoop
        EndIf
    WEnd
EndFunc   ;==>_secondMouse



Func _mouseClick()
    ToolTip("")
    MouseUp("left")
    MouseMove($mouse[0] + GUICtrlRead($xDistanceInput), $mouse[1] + GUICtrlRead($yDistanceInput), 0)
    MouseDown("left")
    Sleep(50)
    MouseUp("left")
    MouseMove($mouse[0], $mouse[1], 0)
    ToolTip("^", $mouse[0] + GUICtrlRead($xDistanceInput), $mouse[1] + GUICtrlRead($yDistanceInput))

EndFunc   ;==>_mouseClick



Func _exit()
    DllClose($dll)
    _save()
    Exit
EndFunc   ;==>_exit

Func _save()
    IniWrite(@ScriptDir & "\MouseX2.ini", "Distance", "X", GUICtrlRead($xDistanceInput, 1))
    IniWrite(@ScriptDir & "\MouseX2.ini", "Distance", "Y", GUICtrlRead($yDistanceInput, 1))
EndFunc   ;==>_save

Func _load()
    GUICtrlSetData($xDistanceInput, IniRead(@ScriptDir & "\MouseX2.ini", "Distance", "X", "200"))
    GUICtrlSetData($yDistanceInput, IniRead(@ScriptDir & "\MouseX2.ini", "Distance", "Y", "0"))
EndFunc   ;==>_load

 

Tested it on two windows of Paint, and it works well

Hello guys, new here, and unfamiliar with AutoIt

 

I tried to modify that script to make it a triple cursor / clicks instead of double.

I managed to have triple clicks somewhat however the 3 mouse markers are now blinking and cannot be seen (they disappear) most of the time so I guess there is something wrong.

 

Would one of you experts give it a quick look and adapt this code to make it triple cursor / clicks ? I'd be really really grateful, thank you

Edited by xdelage

Share this post


Link to post
Share on other sites

Added lines 43 and 60 but like I said the cursors are blinking, especially the middle one which cannot be seen almost always, although it is there

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.14.2
 Author:         myName

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
HotKeySet("{ESC}", "_exit")
HotKeySet("{F10}", "_secondMouse")
$mouse = MouseGetPos()
$dll = DllOpen("user32.dll")
$toggle = 0
#include <Misc.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
$MiceX2 = GUICreate("MiceX2", 184, 92, 192, 124)
$xDistanceInput = GUICtrlCreateInput("200", 128, 0, 49, 21)
$xInfoLabel = GUICtrlCreateLabel("X Distance from Mouse", 8, 4, 114, 17)
$yInfoLabel = GUICtrlCreateLabel("Y Distance from Mouse", 8, 28, 114, 17)
$yDistanceInput = GUICtrlCreateInput("0", 128, 24, 49, 21)
$hotkeyInfo1 = GUICtrlCreateLabel("Start = F10", 16, 48, 83, 17)
$hotkeyInfo1 = GUICtrlCreateLabel("Stop = F9", 16, 64, 83, 17)
$hotkeyInfo2 = GUICtrlCreateLabel("Exit = ESC", 16, 78, 54, 17)
GUISetState(@SW_SHOW)
Opt("GUIOnEventMode", 1) ; Change to OnEvent mode
GUISetOnEvent($GUI_EVENT_CLOSE, "_exit")
_load()
While 1
    Sleep(100)
WEnd

Func _secondMouse()
    While 1
        Sleep(25)
        $mouse = MouseGetPos()
        ToolTip("^", $mouse[0] + GUICtrlRead($xDistanceInput) - 10, $mouse[1] + GUICtrlRead($yDistanceInput))
        ToolTip("^", $mouse[0] + GUICtrlRead($xDistanceInput)  + GUICtrlRead($xDistanceInput) - 10, $mouse[1] + GUICtrlRead($yDistanceInput) + GUICtrlRead($xDistanceInput) + GUICtrlRead($yDistanceInput))
        If _IsPressed("01", $dll) Then _mouseClick()
        If _IsPressed("1B", $dll) Then
            _save()
            Exit
        EndIf
        If _IsPressed("78", $dll) Then
            ToolTip("")
            ExitLoop
         EndIf
    WEnd
 EndFunc   ;==>_secondMouse

Func _mouseClick()
    ToolTip("")
    MouseUp("left")
    MouseMove($mouse[0] + GUICtrlRead($xDistanceInput), $mouse[1] + GUICtrlRead($yDistanceInput), 0)
    MouseMove($mouse[0] + GUICtrlRead($xDistanceInput)  + GUICtrlRead($xDistanceInput), $mouse[1] + GUICtrlRead($yDistanceInput) + GUICtrlRead($xDistanceInput) , 0)
    MouseDown("left")
    Sleep(50)
    MouseUp("left")
    MouseMove($mouse[0], $mouse[1], 0)
    ToolTip("^", $mouse[0] + GUICtrlRead($xDistanceInput), $mouse[1] + GUICtrlRead($yDistanceInput))

EndFunc   ;==>_mouseClick



Func _exit()
    DllClose($dll)
    _save()
    Exit
EndFunc   ;==>_exit

Func _save()
    IniWrite(@ScriptDir & "\MouseX2.ini", "Distance", "X", GUICtrlRead($xDistanceInput, 1))
    IniWrite(@ScriptDir & "\MouseX2.ini", "Distance", "Y", GUICtrlRead($yDistanceInput, 1))
EndFunc   ;==>_save

Func _load()
    GUICtrlSetData($xDistanceInput, IniRead(@ScriptDir & "\MouseX2.ini", "Distance", "X", "200"))
    GUICtrlSetData($yDistanceInput, IniRead(@ScriptDir & "\MouseX2.ini", "Distance", "Y", "0"))
EndFunc   ;==>_load

 

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