When I Hold Down Left Click It Just Continues to Click Repeatedly
I'm making this program that is supposed repeatedly click the mouse button when the mouse button is held down. I have this so far, and it seems to work well, but for some reason, it messes up sometimes (it stops clicking for a second or two, then starts again for a bit, then continues). In other words, it is just very inconsistent. When I tried it on my friend's computer (which is a bit slower) it seemed to mess up in the same way, but just a bit more often. Can someone please tell if I am doing anything wrong or if there is something I can do to make it better?
#SingleInstance force
Suspend , On
LButton::
Loop
{
Click
Sleep, 1
GetKeyState, state, LButton, P
if state = U
break
}
MouseClick, left,,, , , U
return
^!d::Suspend , On
^!a::Suspend , Off
Thanks a lot,
Socom
[Title edited. Please write descriptive titles for your topics. ~jaco0646]
#1 - Posted 14 August 2008 - 04:43 AM
- Back to top
Here's a script I wrote a while ago that does this. Insert toggles auto-click on and off.
Insert:: Hotkey, LButton, Toggle Hotkey, LButton Up, Toggle Return LButton:: Loop { If (Stop) Break Send {lbutton} } Stop := 0 Return LButton Up::Stop := 1
#2 - Posted 14 August 2008 - 05:08 AM
Unless otherwise stated, all code is untested (\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination.
- Back to top
Thanks, that seems to work better. Sorry, I'm kinda new so I really don't know what I'm doing, but is there a way to make that activate with Ctrl + Alt + a and deactivate with Ctrl + Alt + d ? its just easier like that so that way I know for sure if its on or not. Thanks again[/code]
#3 - Posted 14 August 2008 - 07:07 AM
- Back to top
alright never mind about the ctrl alt a thing, i figured that out. but after using this for a while, it seems like it pauses more often actually. also, there seems to be a bit of a delay after the first click before the rest get started
#4 - Posted 14 August 2008 - 07:45 AM
- Back to top
Press Ctrl + Shift + S to start and stop it. It lcicks where ever your mouse is:
Started = 0 ^+s:: If (Started == 0) { Started = 1 SetTimer, Clicking, 1 } Else { Started = 0 SetTimer, Clicking, Off } Return Clicking: Click Return
If you want it to keep clicking where ever your mouse is when you start it, use:
Started = 0 ^+s:: If (Started == 0) { MouseGetPos, X, Y Started = 1 SetTimer, Clicking, 1 } Else { Started = 0 SetTimer, Clicking, Off } Return Clicking: Click, %X%, %Y% Return
#5 - Posted 14 August 2008 - 08:35 AM
- Back to top
If still using the Ctrl+Alt+A to start and Ctrl+Alt+D to stop, you could try this, and it might work better:
^!a::SetTimer, ClickIt, 1 ^!d::SetTimer, ClickIt, Off ClickIt: Click Return
#6 - Posted 14 August 2008 - 09:04 AM
- Back to top
thanks this is all helpful. unfortunately, all of these still seem to lag / mess up pretty often in no apparent patern. does anyone know why this would be?
#7 - Posted 14 August 2008 - 09:10 AM
- Back to top
Try messing around with the SetTimer length (where the 1 currently is) and see if that helps.
#8 - Posted 14 August 2008 - 09:15 AM
- Back to top
alright ill try that thanks
#9 - Posted 14 August 2008 - 09:16 AM
- Back to top
yeah it still seems to be going slowly no matter what i do
#10 - Posted 14 August 2008 - 09:46 AM
- Back to top
Hmm... Is there anything else running in the script that might be interrupting it? If so, try:
^!a::SetTimer, ClickIt, 1, 2147483647 ^!d::SetTimer, ClickIt, Off ClickIt: Click Return
That will set the priority of the thread to the highest, so it won't be interrupted by other stuff.
#11 - Posted 14 August 2008 - 10:21 AM
- Back to top
well i checked and i have no other scripts running. i was thinking, mabye a way to help this could be just copying the script to another file (just with another name) and running them both at once. that could help a bit. if that does help, does anyone know how to make them both start at once and end at once?
#12 - Posted 14 August 2008 - 06:13 PM
- Back to top
Add the tilde prefix so that the keystrokes are not blocked when one of the script picks them up:
[color=red]~[/color]^!a::SetTimer, ClickIt, 1, 2147483647 [color=red]~[/color]^!d::SetTimer, ClickIt, Off ClickIt: Click Return
#13 - Posted 14 August 2008 - 08:00 PM
- Back to top
alright well it still goes pretty slow. but it seems like (im pretty sure this is true), the more stuff going on on the computer, the slower it works. is there a way to allow more memory to go to auto hotkey or go specifically to the mouse or something like that? i think that would solve the problem.
#14 - Posted 14 August 2008 - 08:31 PM
- Back to top
This is a script I worte so that Runescape won't log out me out while fishing that could be changed to do what you need.
RandomButton = 0 RandomFButton = 0 RandomSleep = 0 Started = 0 ^+s:: Started = 1 Loop, { Random, RandomDelay, 3000, 6000 GoSub, Random Sleep (RandomDelay) If (Started == 0) { Break } } Return ^+x:: Started = 0 Return Random: Random, RandomButton, 1, 4 Random, RandomSleep, 500, 2500 If (RandomButton == 1) { Send, {Left Down} } If (RandomButton == 2) { Send, {Up Down} } If (RandomButton == 3) { Send, {Right Down} } If (RandomButton == 4) { Send, {Down Down} } Sleep (RandomSleep) Random, RandomFButton, 1, 8 Send, {F%RandomFButton%} Send, {Left Up} Send, {Up Up} Send, {Right Up} Send, {Down Up} Return
Now, changing this to:
Started = 0 ^+s:: Started = 1 Loop, { Click If (Started == 0) { Break } } Return ^+x:: Started = 0 Return
Press Ctrl+Shift+S to start, and Ctrl+Shift+X to stop. Works perfect on mine even for a long period of time.
#15 - Posted 14 August 2008 - 08:44 PM
- Back to top
davidsonafelf1954.blogspot.com
Source: https://www.autohotkey.com/board/topic/31722-repeatedly-click-the-mouse-button/
0 Response to "When I Hold Down Left Click It Just Continues to Click Repeatedly"
Post a Comment