My scripts keep looping once in a while

Get help with using AutoHotkey and its commands and hotkeys
bbb2k2
Posts: 3
Joined: 10 Jun 2019, 13:13

My scripts keep looping once in a while

10 Jun 2019, 13:35

Hi,

New member here and I have tried to read about the best way to perform certain actions if a hotkey is pressed. In particular I have read this post:

https://www.autohotkey.com/boards/viewtopic.php?p=112919#p112919

I have tried multiple variants but once on a while (maybe 10%) the script does not pick up the SetTimer Off sent via "| up::".

Here is my test script:

Code: Select all

|::
	SetTimer, SpamInArchon, 10
	Gosub, SpamInArchon
	return
	
| up::
	SetTimer, SpamInArchon, Off
	return

SpamInArchon: 
     send +{LButton}
     send 1
 	 return
I want to be able to hold down the | to spam Shift+LButton and press 1, when I release | I want it to stop. At the same time I will also press other keys/use the mouse.

Any idea how to find a better solution?
User avatar
YoucefHam
Posts: 344
Joined: 24 Aug 2015, 12:56
Facebook: https://fb.me/YoucefHamDz
Google: [email protected]
GitHub: YoucefHam
Location: Algeria
Contact:

Re: My scripts keep looping once in a while

10 Jun 2019, 15:34

try this

Code: Select all

*|::
	SetTimer, SpamInArchon, 10
	Gosub, SpamInArchon
	return
	
*| up::
	SetTimer, SpamInArchon, Off
	return

SpamInArchon: 
send +{LButton}
send 1
return
:wave: There is always more than one way to solve a problem. ;)
bbb2k2
Posts: 3
Joined: 10 Jun 2019, 13:13

Re: My scripts keep looping once in a while

11 Jun 2019, 09:27

Thanks, so far it looks promising. Will do some more testing later tonight.
bbb2k2
Posts: 3
Joined: 10 Jun 2019, 13:13

Re: My scripts keep looping once in a while

14 Jun 2019, 12:47

Sadly I still have the same problem, when I play about 10% of the time it does not detect the release "*| up".

Any idea how i can further debug this? It's really a simple script that when pressing | it should:

Loop until | key released
{
Shift+Left Click Mouse
Send 1
Sleep 10ms
}

I tested to let is keep looping for a while to see if it eventually stops (maybe due to buffering keystrokes or something) but it does not, it loops until it gets a new "1 up".

Return to “Ask For Help”

Who is online

Users browsing this forum: AlexIII, CluelessHotKeyUser, Google [Bot], JoeWinograd, mikeyww, murataygun and 43 guests