1

Тема: AHK: Спам лкм при зажатой лкм

Имеется скрипт

[::Suspend 
LButton:: 
Loop 
{ 
SetMouseDelay 30 
Click 
If (GetKeyState("LButton","P")=0) 
Break 
}

но он работает не корректно, точнее при первом единичном нажатии происходит 2 клика, а при втором один. Выходит, что одно из двух единичных нажатий производит 2 нажатия. Подскажите как это исправить, нодо чтобы если нажал 1 раз на ЛКМ, то произошел именно один клик, а при зажатии ЛКМ, происходил  спам лкм.

2 (изменено: rowe, 2018-04-09 18:50:41)

Re: AHK: Спам лкм при зажатой лкм

~$LButton::
    While GetKeyState("LButton", "P")
	{
        Click
        Sleep 150 
    }
return

3 (изменено: rowe, 2018-04-09 19:35:56)

Re: AHK: Спам лкм при зажатой лкм

Или через SetTimer. На примере Win+c


#c::
if winc_presses > 0 ; SetTimer already started, so we log the keypress instead.
{
    winc_presses += 1
    return
}
; Otherwise, this is the first press of a new series. Set count to 1 and start
; the timer:
winc_presses = 1
SetTimer, KeyWinC, -400 ; Wait for more presses within a 400 millisecond window.
return

KeyWinC:
if winc_presses = 1 ; The key was pressed once.
{
    Run, m:\  ; Open a folder.
}
else if winc_presses = 2 ; The key was pressed twice.
{
    Run, m:\multimedia  ; Open a different folder.
}
else if winc_presses > 2
{
    MsgBox, Three or more clicks detected.
}
; Regardless of which action above was triggered, reset the count to
; prepare for the next series of presses:
winc_presses = 0
return