Jump to content

MouseClick - MouseDown


Recommended Posts

Hello

I have a problem with my left key of my mouse. I have buy a new mouse from a well knows store but they have some shipping problem and i need to wait 2 week...

So for now i have think to bind a key to the mouse click:

#include <Misc.au3>

HotKeySet("a", "_Mouse_Left")

Local $hDLL = DllOpen("user32.dll")

Func _Mouse_Left()
    MouseClick("left")
    If _IsPressed("41", $hDLL) Then
        Do
            MouseDown("left")
        Until _IsPressed("41", $hDLL) = False
    Else
        MouseUp("left")
    EndIf
EndFunc   ;==>_Mouse_Left

The problem is not with the "click", but with the selection

If i keep press the "a" key i want to do a selection with the mouse like if i keep press the mouse left key

Thanks for any help

Edited by Terenz

Nothing is so strong as gentleness. Nothing is so gentle as real strength

 

Link to comment
Share on other sites

I don't think mixing HotKeySet with _IsPressed is going to be useful here.. I would rather use _IsPressed to perform a click every time you release "a"  and if you are holding it down it's like you are holding down the left mouse button. (this is exactly like a mouse but using a keyboard key instead of a mouse)

Example:

#include <Misc.au3>

$dll = DllOpen( "user32.dll" )

While 1
    If _IsPressed( "1B",$dll ) Then ExitLoop ;Exit if Esc is pressed

    If _IsPressed( "41",$dll ) Then
        MouseDown( "left" )

        Do
        Until _IsPressed( "41",$dll ) = False

        MouseUp( "left" )
    EndIf
WEnd

DllClose( $dll )

:bye:

Cause no one here can ever stop us, they can try but we won't let them.. No way

Link to comment
Share on other sites

#include <Misc.au3>
HotKeySet("{ESC}", "_Mouse_Left")
$hDLL = DllOpen("user32.dll")

While 1
WEnd

Func _Mouse_Left()
    HotKeySet("{ESC}")
    MouseDown("left")
    While _IsPressed("1B", $hDLL)
        Sleep(10)
    WEnd
    MouseUp("left")
    HotKeySet("{ESC}", "_Mouse_Left")
EndFunc   ;==>_Mouse_Left

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

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...