Jump to content

holding down mouse button


Recommended Posts

Hi, I am a newbie to autoit and this might be easy for all the experts here.

I would like to make a simple script that runs in the background and when its activated just holds down the left button until I inactivate it.

This is for a game that requires you to hold down the mouse button when fighting and it gets very unergonomic after a while.

Please help a new member.

thank you. :P

Link to post
Share on other sites

Hi, I am a newbie to autoit and this might be easy for all the experts here.

I would like to make a simple script that runs in the background and when its activated just holds down the left button until I inactivate it.

This is for a game that requires you to hold down the mouse button when fighting and it gets very unergonomic after a while.

Please help a new member.

thank you. :P

Lookup HotKeySet and MouseDown in the help file. You will also need a loop and a sleep.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to post
Share on other sites

Welcome to the forums!

It sounds like you want the MouseDown() and MouseUp() functions. We could write a script that listens for two keys -- one will push the mouse down or up and the other will quit the script. Here's something like that:

; Function to toggle the mouse button
Func ToggleMouse()
   ; Variable to indicate whether the mouse is already down
    Global $Down
    If $Down Then
        MouseUp('Left')
    Else
        MouseDown('Left')
    EndIf
   ; Swap the value of the variable to reflect the new state
    $Down = Not $Down
EndFunc

; Function to end the script
Func Off()
    Exit
EndFunc

; Set the hotkeys up
HotkeySet('z', 'ToggleMouse')
HotkeySet('x', 'Off')

; Do nothing (keeps the script around to process the keys)
While 1
    Sleep(1000)
WEnd
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...