1

キーボードに問題があり、特定のキーでかなりひどいキーボードのチャタリングが発生しています。キーボードのキー押下をフィルタリングするのに役立つautohotkeyスクリプトを見つけることができましたが、実際には、同じキーを押したままにすると同じキーを繰り返し送信するため、キーを必要とするアプリケーションを使用する場合に問題が発生します。特定のショートカット(Maya、XSIなど)を押し続ける

{blind}フラグを使用してSendInputコマンドを変更し、%k_ThisHotkey%に'down'修飾子を追加しようとしましたが、正しく機能させることができませんでした。

(最初のsendinputに「down」を追加し、キーが押されているかどうかを確認するためにGetKeyStateを実行してから、キーが解放されるとSendInput upが実行されるという条件を実行しました。ただし、これは実行されませんでした。意図したとおりに機能し、私はアイデアがありません。)

キーを押したままにして、適切なデバウンサースクリプトを機能させる方法について、誰かが喜んでいくつかの指針を示してくれるでしょうか。

ありがとう!

; ---- setups
#UseHook On
;Capslock::LShift


; ---- initialize parameters
if (%0% > 0)
    k_TimeThreshold = %1%
else
    k_TimeThreshold = 40
;k_TimeThreshold = 1000  ; for debugging


; ---- initialize variables
k_LastHotkey = 0
k_LastTick := A_TickCount


; ---- Set all keys as hotkeys. See www.asciitable.com
k_ASCII = 33
Loop
{
    Transform, k_char, Chr, %k_ASCII%

    Hotkey, %k_char%, k_KeyPress

        if ((k_char Not In +,^)  AND  (k_ASCII != 123  AND k_ASCII != 125))
    {
        Hotkey, +%k_char%, k_KeyPress       ; shift
        ; Hotkey, ^%k_char%, k_KeyPress     ; control
        ; Hotkey, !%k_char%, k_KeyPress     ; alt
        ; Hotkey, #%k_char%, k_KeyPress     ; win
    }

    if k_ASCII = 64
        k_ASCII = 91
    else if k_ASCII = 126
        break
    else
        k_ASCII++
}
return 

; ---- End of auto-execute section.


; ---- When a key is pressed by the user, send it forward only if it's not a "bounce"
; ---- A "bounce" is defined as: "key is same as last"  AND  "time since last key is very short"
Enter::
Space::
Tab::
Esc::
BS::
Del::
Ins::
Home::
End::
PgUp::
PgDn::
Up::
Down::
Left::
Right::
k_KeyPress:
{
    k_ThisHotkey := A_ThisHotkey        ; grab the current hotkey
    k_ThisTick := A_TickCount       ; grab the current tick
    ElapsedTime := k_ThisTick - k_LastTick  ; time since last hotkey (ticks)

    if (ElapsedTime > k_TimeThreshold  ||  k_ThisHotkey <> k_LastHotkey)
    {
        if k_ThisHotkey In !,#,^,+,{,},Enter,Space,Tab,Esc,BS,Del,Ins,Home,End,PgUp,PgDn,Up,Down,Left,Right
            SendInput {%k_ThisHotkey%}
        else
            SendInput %k_ThisHotkey%
        ;SendInput %ElapsedTime%  ; for debugging
    }

    k_LastHotkey := k_ThisHotkey    ; store the current hotkey for next time
    k_LastTick := k_ThisTick    ; store the current tick for next time
}
return

; ---- other keys that could be filtered (but caused issues on some keyboards)
;LWin::
;RWin::
;LAlt::
;RAlt::
4

1 に答える 1

0

ここにアイデアがあります。問題が解決するかどうかはわかりません。お知らせ下さい。Shift を使用して文字をシフトできますが、バウンシー キーと通常のキー押しの間には明らかな違いがあります。Shiftqおよびでのみテストしましたa

#SingleInstance Force
#installKeybdHook
#Persistent

Shift::
q::
a::
keywait, %A_ThisHotkey%
if (A_PriorHotkey = A_ThisHotkey AND A_TimeSincePriorHotkey < 900)  ; bouncy key
{
    Soundbeep, 500, 200
    Return
}
Soundbeep, 2000, 200
return
于 2013-03-15T08:16:13.117 に答える