Script with longer mouse click to toggle mouse hold?

Ask gaming related questions
TheRaven
Posts: 3
Joined: 12 Jul 2020, 06:18

Script with longer mouse click to toggle mouse hold?

12 Jul 2020, 06:40

I don't know if this is possible:

I'd like a script for "hold mouse button to attack" where:

- if you hold left mouse button for 1sec, then left mouse button is held, if you click again (a short click), mouse button is released (and short mouse clicks will function as normal again)

AND

- if you hold right mouse button for 1sec, then right mouse button is held, if you click right again (a short click), right mouse button is released



I know this would be easier with a toggle key, but all my easily reachable keys are already used up by other functions.

This would help so much with hand and arm pain. Thanks a lot!
Raven
Rohwedder
Posts: 3252
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Script with longer mouse click to toggle mouse hold?

12 Jul 2020, 08:25

Hallo,
try:

Code: Select all

*$LButton::
SendInput, {Blind}{LButton Down}
KeyWait, LButton, T1
IF !ErrorLevel
   SendInput, {Blind}{LButton Up}					
Return
if successful, the same with RButton
TheRaven
Posts: 3
Joined: 12 Jul 2020, 06:18

Re: Script with longer mouse click to toggle mouse hold?

12 Jul 2020, 10:04

Thanks for the answer,
unfortunately, it doesn't work, doesn't hold the mouse button down.
Rohwedder
Posts: 3252
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Script with longer mouse click to toggle mouse hold?

12 Jul 2020, 10:45

I have tried this in the editor.
The tooltip timer shows the logical status of LButton.

Code: Select all

SetTimer, T, 100
T:
ToolTip,% GetKeyState("LButton")
Return

*$LButton::
SendInput, {Blind}{LButton Down}
KeyWait, LButton, T1
IF !ErrorLevel
   SendInput, {Blind}{LButton Up}					
Return
If it does not work in a game: Run as admin, compile, any weird dll, cry …
TheRaven
Posts: 3
Joined: 12 Jul 2020, 06:18

Re: Script with longer mouse click to toggle mouse hold?

12 Jul 2020, 13:40

Yes, it works in windows, will also be handy for some tasks, like marking text. Thanks for the script!

But it does not work in game. Seems AKH is blocked.

Return to “Gaming”

Who is online

Users browsing this forum: No registered users and 26 guests