Autohotkey 使用自动热键过滤键盘输入

Autohotkey 使用自动热键过滤键盘输入,autohotkey,Autohotkey,我最近弄坏了键盘,用自动热键写了一些临时的低效程序来修复它们 以下是我当前笔记本电脑键盘的输出: y=ry h=fh n={enter}+n 6=46 我目前有4个自动热键文件为每个断开的关键运行。下面是h的文件 哈德刚,啊 #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. ; #Warn ; Enable warnings to assist with detect

我最近弄坏了键盘,用自动热键写了一些临时的低效程序来修复它们

以下是我当前笔记本电脑键盘的输出: y=ry h=fh n={enter}+n 6=46

我目前有4个自动热键文件为每个断开的关键运行。下面是h的文件

哈德刚,啊

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

while true {

KeyWait, h,D
Sleep 20
Send {BS}
Send {BS}
Send {h}


}
:?*:fh::h
:?*:hf::h
:?*:ry::y
:?*:yr::y
:?*:46::6
:?*:64::6
:?*:n{Enter}::n
:?*:{Enter}n::n
如何将四个.ahk文件合并为1?还有更好的方法吗

**编辑我在一个文件中找到了一种方法,但我无法使用n/enter键

这是代码

斯塔克·阿赫

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

while true {

KeyWait, h,D
Sleep 20
Send {BS}
Send {BS}
Send {h}


}
:?*:fh::h
:?*:hf::h
:?*:ry::y
:?*:yr::y
:?*:46::6
:?*:64::6
:?*:n{Enter}::n
:?*:{Enter}n::n

对于最后两个条目,您可以使用以下代码:

:*:n`n::n
:*:`nn::n

;Comment: `n = {Enter}

如果键盘几乎同时发送双键, 有可能使它们成为双热键

这样你仍然可以输入像“愤怒”这样的词

y&r::send,{blind}r
$y::发送,{blind}y
$+y::发送,{blind}y
4&6::发送,{blind}6
$4::发送,{blind}4
$+4::发送,{blind}$
发送,{blind}h
$f::发送,{blind}f
$+f::发送,{blind}f
n&Enter::send,{blind}n
$n::发送,{blind}n
$+n::发送,{blind}n
$Enter::
如果(A_PriorHotkey=“n”)和(A_TimeSincePriorHotkey<500)
{
声音嘟嘟,500,200
返回
}
发送,{Enter}
返回
发送“盲”(针对shift、alt和ctrl状态) 可能没有必要,但不会造成伤害。 更新:由于Enter似乎被卡住了,我将删除Enter直到
最后一次n。在这种情况下,我发出嘟嘟声来做个笔记。

谢谢Robert,它现在对重复的n有效,但在一个句子中仍然不起作用。我只是试着把它改为:?*:n
n::n:?*:
nn::n,而且它的效果更好,但是换行符在这里和那里漏掉了。谢谢576i。不管怎么说,这似乎效果不错。我仍然会在诸如fb聊天室、chrome地址栏和任何其他输入键有动作的地方使用输入键,编辑脚本以捕捉在“n”后500毫秒内按下的任何输入键。我还添加了“移位”键,因为脚本是大写字母。如果Alt+Cltr组合被此脚本终止,您也需要添加它们。如果它不起作用,请不要忘记将其标记为已解决:)抱歉,仍然不起作用:/通常,当我按“n”时,它会输出“enter”,然后是“n”,但有时会切换顺序。我需要类似于“$Enter::elapsedTime=0 while(运行时间<500){如果(n被按下){send n return}Sleep 50 elapsedTime+=50}return}}的东西,但是找不到检查n是否被按下的好方法OK,您正在寻找“GetKeyState”命令。因此,您需要将Enter热键扩展为循环500毫秒,并获取n键的状态,如果按下,则退出。然后n将启动它自己的热键。唉,我没有时间在周末之前为你写完整的剧本。。。