Sign in to follow this  
Followers 0
mark089

Mouse movement issue

4 posts in this topic

Hello all,

with the help of scripts I found online, I made a GUI with eight buttons, each button for one relative mouse movement. This GUI is part of a Client App on my laptop, that connects to the Server App on the desktop PC, where these signals are translated into mouse movements.

Client app:

$cb_mouse_lu = GUICtrlCreateButton("", 287, 15, 20, 20)
$cb_mouse_rd = GUICtrlCreateButton("", 334, 54, 20, 20)
$cb_mouse_ru = GUICtrlCreateButton("", 334, 15, 20, 20)
$cb_mouseup = GUICtrlCreateButton("", 310, 15, 20, 20)
$cb_mouseright = GUICtrlCreateButton("", 334, 34, 20, 20)
$cb_mouseleft = GUICtrlCreateButton("", 287, 34, 20, 20)
$cb_mouse_ld = GUICtrlCreateButton("", 287, 54, 20, 20)
$cb_mousedown = GUICtrlCreateButton("", 310, 54, 20, 20)
$cb_mouseclick = GUICtrlCreateButton("", 310, 34, 20, 20)

TCPStartup()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $cb_mouseclick
            $message = "mouseclick"
            TCPSend($connectedSocket, $message)
        Case $msg = $cb_mouseleft
            $message = "mouseleft"
            TCPSend($connectedSocket, $message)
        Case $msg = $cb_mouseright
            $message = "mouseright"
            TCPSend($connectedSocket, $message)
        Case $msg = $cb_mouseup
            $message = "mouseup"
            TCPSend($connectedSocket, $message)
        Case $msg = $cb_mousedown
            $message = "mousedown"
            TCPSend($connectedSocket, $message)
        Case $msg = $cb_mouse_ld
            $message = "mouse_ld"
            TCPSend($connectedSocket, $message)
        Case $msg = $cb_mouse_lu
            $message = "mouse_lu"
            TCPSend($connectedSocket, $message)
        Case $msg = $cb_mouse_rd
            $message = "mouse_rd"
            TCPSend($connectedSocket, $message)
        Case $msg = $cb_mouse_ru
            $message = "mouse_ru"
            TCPSend($connectedSocket, $message)
    EndSelect
WEnd
TCPShutdown()

Server App:

Case $msg = "mouseclick"
                MouseClick("left")
            Case $msg = "mouseleft"
                _MouseMoveRelative(-30, 0)
            Case $msg = "mouseright"
                _MouseMoveRelative(30, 0)
            Case $msg = "mouseup"
                _MouseMoveRelative(0, -30)
            Case $msg = "mousedown"
                _MouseMoveRelative(0, 30)
            Case $msg = "mouse_lu"
                _MouseMoveRelative(-30, -30)
            Case $msg = "mouse_ld"
                _MouseMoveRelative(-30, 30)
            Case $msg = "mouse_ru"
                _MouseMoveRelative(30, -30)
            Case $msg = "mouse_rd"
                _MouseMoveRelative(30, 30)
                
Func _MouseMoveRelative ($iX, $iY)
    local $pos = MouseGetPos()
    MouseMove($pos[0] + $iX, $pos[1] + $iY,0)
EndFunc

Now everything works fine, except the horizontal mouse movements (mouse left and mouse right).

I even tried to combine the movements "mouse to the left up" and "mouse to the left down" in one Case, but this also does not work (though they work perfectls when each on their own).

Nevertheless the desktop PC receives signals, as those buttons sometimes lead to highlighting a shortcut on the desktop.

Does anyone have a clue, where the problem might be?

Share this post


Link to post
Share on other sites



The problem lies in part of the code you decided not to post.

 

The mouse movement function is only a small part of the whole script. Therefore I tried to just extract the relevant parts. No variable name is being use twice, if this is, what you suppose.

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