I have code like the following. This code is written for a game that is free to use macro autohotkey macro code. But when I hold down the left click with this code, it pulls the cursor down steadily and non-stop.
I want that with editing on this code, let's stop the cursor after taking the cursor down for example 600ms, that's it. I wonder if we can make this arrangement in this code?
code 1
Code:
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
; SS
^!p::Suspend
; NR
~LButton::
while GetKeyState("LButton")
{
DllCall("mouse_event", uint, 1, int, 0, int, 2, uint, 0, int, 0)
Sleep, 15
DllCall("mouse_event", uint, 1, int, 0, int, 2, uint, 0, int, 0)
Sleep, 5
}
return
; Nades
~MButton::
if GetKeyState("LButton")
{
Sleep, 3000
MouseClick, Left,,,,, U
}
return
Insert::ExitApp
OR code 2
Code:
#NoEnv
SendMode Input
_auto := true
~LButton::autofire()
+LButton::_auto := ! _auto
F1::ExitApp
autofire()
{
global _auto
if _auto
{
Loop
{
if GetKeyState("LButton", "P")
{
Sleep 25
mouseXY(0, 6)
Sleep 20
}
else
break
} ;; loop
} ;; if
} ;; autofire()
mouseXY(x,y)
{
DllCall("mouse_event",uint,1,int,x,int,y,uint,0,int,0)
}