AHK - 如何忽略一组10个键中的最后2个按键

时间:2016-12-09 20:55:23

标签: autohotkey

如果我能找到如何创建一个忽略最后2个按键的脚本(ahk),我将非常感激。

比如说我们有A,B,C,D,E,F,G,H,I和J作为我们的10个键的集合。

我希望脚本以下列方式执行操作: 在脚本开始时:

-say key A is pressed - send custom action
-say key B is pressed - send custom action

-say Key A is pressed - send A
-say key B is pressed - send B

-say key C is pressed - send custom action
-say Key C is pressed - send C
-say Key B is pressed - send B
-say key A is pressed - send custom action again as the script would need to now ignore keys C and B (this is the part that im struggling with)

我尝试在循环中使用A_PriorHotkey,使用错误级别和GetKeyState但没有运气......

非常感谢任何帮助。

谢谢。

1 个答案:

答案 0 :(得分:0)

这是一个非常难以理解的问题, 但那又是一个很难提出的问题。 我相信我有正确的解决方案,或者或多或少是正确的, 这对代码来说是一个非常有趣的挑战。 哇,你为什么需要这样的剧本?请解释一下。 我现在很想知道。

$a::
$b::
$c::
$d::
$e::
$f::
$g::
$h::
$i::
$j::
vLetter := SubStr(A_ThisHotkey, 1-1)
vLast2 := SubStr(vLog, 1-2)
if InStr(vLast2, vLetter)
SendInput %vLetter%
else
MyFunc(vLetter), vLog .= vLetter
Return

MyFunc(vLetter)
{
StringUpper, vLetter, vLetter
SendInput %vLetter%
Return
}
相关问题