Jump to content
Sign in to follow this  
Ramzy

Binding function to mouse?

Recommended Posts

Ramzy

What is the left and right mouse button referred to as? I have made an auto clicking script, but i would like to bind it to start clicking once the left mouse button is pressed down.

So, instead of {F9}, what would i use to bind it to the mouse button? Thanks.

Here is the source:

$startclick = InputBox("Question", "Button to start left clicking", "{F9}", "", -1, -1, 0, 0)
$Rightclick = InputBox("Question", "Button to start right clicking", "{F10}", "", -1, -1, 0, 0)
$HK_STOP = InputBox("Question", "Button to stop all clicking commands", "{F11}", "", -1, -1, 0, 0)

HotKeySet($startclick, "startclick")
HotkeySet($HK_STOP, "HK_STOP")
Hotkeyset($Rightclick,  "Rightclick")

; This is the clicking function
Func startclick()
; Continuous loop that clicks the left mouse button
while(1)

; Starts the auto clicker
MouseClick("left")
Opt("MouseClickDelay", 10)
WEnd
EndFunc

Func Rightclick()
; Continuous loop that clicks the left mouse button
while(1)
MouseClick("Right")
WEnd
EndFunc

; Stops the program
Func HK_STOP()
while 1 = 1
  Sleep(1000)
wend
EndFunc

; Need to keep the program running until you press the hotkey
while(1)
sleep(1000)
WEnd

Share this post


Link to post
Share on other sites
Ramzy

Blah, no one can at least let me know if the mouse button can even be binded to a function?

Share this post


Link to post
Share on other sites
n2989

#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1
    Sleep ( 250 )
    If _IsPressed("01", $dll) Then
        MsgBox(0,"_IsPressed", "End Key Pressed")
        ExitLoop
    EndIf
WEnd
DllClose($dll)

You might try searching on _IsPressed. I think it is number 01 and 02 for the left and right mouse buttons

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  

×