When I Hold Down Left Click It Just Continues to Click Repeatedly

socom18800

  • Guests
  • Last active:
  • Joined: --

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]

  • Back to top

  • Members
  • 739 posts
  • Last active: Jul 08 2011 05:26 AM
  • Joined: 28 May 2008

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

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

socom18800

  • Guests
  • Last active:
  • Joined: --

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]

  • Back to top

socom18800

  • Guests
  • Last active:
  • Joined: --

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

  • Back to top

Wicked - Guest

  • Guests
  • Last active:
  • Joined: --

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

  • Back to top

Krogdor

  • Members
  • 1391 posts
  • Last active: Jun 08 2011 05:31 AM
  • Joined: 18 Apr 2008

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

  • Back to top

socom1880

  • Members
  • 73 posts
  • Last active: Jun 06 2011 07:40 AM
  • Joined: 14 Aug 2008

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?

  • Back to top

Krogdor

  • Members
  • 1391 posts
  • Last active: Jun 08 2011 05:31 AM
  • Joined: 18 Apr 2008

Try messing around with the SetTimer length (where the 1 currently is) and see if that helps.

  • Back to top

socom1880

  • Members
  • 73 posts
  • Last active: Jun 06 2011 07:40 AM
  • Joined: 14 Aug 2008

alright ill try that thanks

  • Back to top

socom1880

  • Members
  • 73 posts
  • Last active: Jun 06 2011 07:40 AM
  • Joined: 14 Aug 2008

yeah it still seems to be going slowly no matter what i do

  • Back to top

Krogdor

  • Members
  • 1391 posts
  • Last active: Jun 08 2011 05:31 AM
  • Joined: 18 Apr 2008

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.

  • Back to top

socom1880

  • Members
  • 73 posts
  • Last active: Jun 06 2011 07:40 AM
  • Joined: 14 Aug 2008

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?

  • Back to top

Krogdor

  • Members
  • 1391 posts
  • Last active: Jun 08 2011 05:31 AM
  • Joined: 18 Apr 2008

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

  • Back to top

socom1880

  • Members
  • 73 posts
  • Last active: Jun 06 2011 07:40 AM
  • Joined: 14 Aug 2008

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.

  • Back to top

Wicked

  • Members
  • 504 posts
  • Last active: Nov 18 2018 02:17 AM
  • Joined: 07 Jun 2008

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.

  • 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

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel