let this count to 123456
Code: Select all
$q::
SetKeyDelay, 500, 500
While GetKeyState("q","P")
Send,% A_Index
;Sleep, 0
Return
71 hotkeys have been received in the last 0ms …
The Sleep, 0 prevents this.
Code: Select all
$q::
SetKeyDelay, 500, 500
While GetKeyState("q","P")
Send,% A_Index
;Sleep, 0
Return
It is the same effect as using Critical:If a hotkey is pressed or a custom menu item is selected while the current thread is uninterruptible, that event will be buffered.
Source: Thread - Syntax & Usage | AutoHotkey
Code: Select all
i := 0, c := 0
#if ++c ; Count the number of activations detected by the hook.
; (Assuming #If is only called once for each activation,
; which is true in this case but might not be in others.)
$q::
Critical
ToolTip % ++i " " c
while A_TimeSinceThisHotkey < 5000
WinExist("just wasting time")
; Critical Off
; Sleep, 0
Return
It literally means #MaxThreadsBuffer only buffers up to one activation - it may run a second time. In this case, it repeats as many times as the key repeated - it's not related to #MaxThreadsBuffer.For example, if you accidentally press a hotkey twice, having this setting ON would cause that hotkey's subroutine to automatically run a second time if its first thread takes less than 1 second to finish (this type of buffer expires after 1 second, by design). Note that AutoHotkey buffers hotkeys in several other ways (such as Thread Interrupt and Critical). It's just that this particular way can be detrimental, thus it is OFF by default.
Source: #MaxThreadsBuffer - Syntax & Usage | AutoHotkey
Users browsing this forum: No registered users and 51 guests