whilst i was making a script, i came to realise that GetKeyState did not obey the pause function. Could somebody please help make a script which clicks a lot of time when you hold the left button down which can also be paused, preferably with the pause function.
This is my script as of now:
Pause,on
Lbutton::
while (GetKeyState("Lbutton", "P"))
{
Send {Click}
Sleep, 1
}
`::Pause,Toggle
Many Thanks.
Help with GetKeyState
-
- Posts: 10
- Joined: 17 Apr 2020, 08:44
Re: Help with GetKeyState
Instead of using Pause, I would use a variable that it checks. When you use Pause, it has to do with the current thread, and hotkeys launching new threads can confuse the issue. Try this:
Code: Select all
Lbutton::
while (GetKeyState("Lbutton", "P"))
{
if Toggle
{
Send {Click}
Sleep, 1
}
}
return
`::
Toggle := !Toggle
ToolTip, % Toggle ? "ON" : "OFF"
SetTimer, ToolTipOff, -1000
return
ToolTipOff:
ToolTip
return
Esc::ExitApp
-
- Posts: 10
- Joined: 17 Apr 2020, 08:44
Re: Help with GetKeyState
this code is really great however when i turn it off it doesn't allow me to press anything. You should try the script to see what i mean
Thanks tho
Thanks tho
Re: Help with GetKeyState
I would probably use Hotkey for this.
That way you can turn it on/off without having to remap LButton easily.
That way you can turn it on/off without having to remap LButton easily.
Code: Select all
#Persistent
F1::
Toggle:=!Toggle
Hotkey, LButton, LBDown, % Toggle ? "On":"Off"
Return
LBDown:
while (GetKeyState("Lbutton", "P"))
{
Send {Click}
Sleep, 1
}
Return
Who is online
Users browsing this forum: AHK_user and 242 guests