预期热键功能:如果按键长度超过0.2秒,则大写字符
发生问题:输入" vbnm "以快速的方式连续(这意味着我按下下一个键同时仍然按住前一个键)然后AHK只输出先按下的键的x倍,这里产生于" vvvv "
这就是代码。请帮帮我(y):-)
$y::
$x::
$c::
$v::
$b::
$n::
$m::
key := SubStr(A_ThisHotkey, 2)
;MsgBox, %key% ;it recognizes/shows all keys pressed correctly,
;but in the end it prints just x-times the key that was pressed first
;whereby x is the number of keys pressed very quickly in a row
KeyWait, %key%, T0.2 ;Long press = capitalize
If ErrorLevel
SendInput +%key%
Else
SendInput %key%
Return
答案 0 :(得分:1)
所以最后这个代码似乎有效,除了在按住密钥太长时间带来的小麻烦之外,导致例如"乌"
;For normal characters ......
$x::
$c::
$v::
$b::
$n::
$m::keyFunc(SubStr(A_ThisHotkey, 2))
keyFunc(key) {
Critical
KeyWait, %key%, T0.3 ;Long press = capitalize
SendInput % ErrorLevel ? Format("{:U}", key) : key
Return
}
;For special characters ......
$2::
$3::
$4::
$5::
$6::
$7::
$8::
$9::
$sc01A:: ;ü
$sc027:: ;ö
$sc028:: ;ä
$sc00C:: ;ß
$sc033:: ;,
$sc034:: ;.
$sc035:: ;-
$sc01B:: ;+
$sc02B:: ;#
$sc00D:: keyFunc2(SubStr(A_ThisHotkey, 2))
keyFunc2(key) {
Critical
KeyWait, %key%, T0.3 ;Long press = capitalize
If ErrorLevel
SendInput +{%key%}
Else
SendInput {%key%}
Return
}
答案 1 :(得分:0)
尝试:
$y::
$x::
$c::
$v::
$b::
$n::
$m::keyFunc(SubStr(A_ThisHotkey, 2))
keyFunc(key) {
KeyWait, %key%, T0.3 ;Long press = capitalize
SendInput % ErrorLevel ? Format("{:U}", key) : key
Return
}