如何在AHK中检测Ctrl + V?

时间:2014-12-04 13:04:29

标签: autohotkey

我正在尝试检测 Ctrl + V 。然后,让Xbutton1充当 Enter 几秒钟,但我无法使其正常工作。

Transform, CtrlV, Chr, 3
Input, OutputVar, L1 M

XButton1::
    if OutputVar = CtrlV
    {
        SetTimer, SendEnter, 0
        Sleep, 2000
        SetTimer, SendEnter, Off
    }
    else
    {
        Send  ^t
    }
Return

SendEnter:
    Send {Enter}
Return

1 个答案:

答案 0 :(得分:1)

~^v::lastPaste := A_TickCount ;stores counter when ctrl+v is pressed   
    Xbutton1::
        If A_TickCount - lastPaste < 2000 ;checks if 2 seconds gone after ctrl+v was clicked
        {
            Send, {Enter} ;sends enter
            Return
        }
        else
        {
            Send, ^t ;sends ctrl+t
            Return
        }