Jump to content

Mouse click when pressed


beserk1
 Share

Recommended Posts

I just want to create a simple script that whenever the mouse button is held down, the script will keep clicking at an interval until the button is release.

I use _IsPressed to check and that works, but the click part does not work as I have imagine it would be.

I tried both MouseUp with MouseDown combination and a simple MouseClick, neither prevails.

I think the problem lies with that my physical mouse button is pressed, and the click generated by the script will not supersede the physical ones. Is there anyway to make this work?

Here is my script

#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1
    Sleep ( 100 )
    If _IsPressed("01", $dll) Then
        MouseUp("left")
        MouseDown("left")
    EndIf
    If _IsPressed("02", $dll) Then
        MouseClick ( "right" )
    EndIf
WEnd
DllClose($dll)
Edited by beserk1
Link to comment
Share on other sites

#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1
    Sleep ( 100 )
    If _IsPressed("01", $dll) Then
        MouseUp("left")    ;<====   you need to add here awaiting MouseUp, before doing something..
        MouseDown("left")
    EndIf
    If _IsPressed("02", $dll) Then
        MouseClick ( "right" )
    EndIf
WEnd
DllClose($dll)

Edited by Godless

_____________________________________________________________________________

Link to comment
Share on other sites

I'm confused by what you want it to do- it looks to me that you're asking the script to click whenever you click. At the most, this might turn every single click into a double-click...is that what you want? Or do you want it to begin repeating whatever physical click you make, at an interval, for a number of repetions?

"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110
Link to comment
Share on other sites

@Godless: I am not sure I understand what you are trying to say. Are you saying that I need to have a waiting period before using the MouseUp, or MouseUp awaiting something? I am confused...

@james3mg: I am trying to make a script so when the left button is held down, the script will keep clicking for me. Basically whenever the mouse button is held down, the script will keep clicking at an interval until the button is release.

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