Keyboard 我可以让这个自动热键qwerty半键盘脚本在大写锁定的情况下工作吗?

Keyboard 我可以让这个自动热键qwerty半键盘脚本在大写锁定的情况下工作吗?,keyboard,autohotkey,Keyboard,Autohotkey,我在网站上找到了这个脚本 此脚本的作用是将空格键重新映射为修改器。当保持空格时,键盘会反转,g和h之间有一条对称线。因此,e将变成i,b将变成n,p将变成q,依此类推。如果在不按任何其他键的情况下按下并释放空格键,则发送单个空格。shift或control等修改键可以与半qwerty组合使用 问题是,当大写锁定处于启用状态时,它不适用于大写字母 任何帮助都会很棒 ;QWERTY half-keyboard emulator mirror_1 = 0 mirror_2 = 9 mirror_3

我在网站上找到了这个脚本

此脚本的作用是将空格键重新映射为修改器。当保持空格时,键盘会反转,g和h之间有一条对称线。因此,e将变成i,b将变成n,p将变成q,依此类推。如果在不按任何其他键的情况下按下并释放空格键,则发送单个空格。shift或control等修改键可以与半qwerty组合使用

问题是,当大写锁定处于启用状态时,它不适用于大写字母

任何帮助都会很棒

;QWERTY half-keyboard emulator

mirror_1 = 0
mirror_2 = 9
mirror_3 = 8
mirror_4 = 7
mirror_5 = 6
mirror_q = p
mirror_w = o
mirror_e = i
mirror_r = u
mirror_t = y
mirror_a = `;
mirror_s = l
mirror_d = k
mirror_f = j
mirror_g = h
mirror_z = /
mirror_x = .
mirror_c = ,
mirror_v = m
mirror_b = n
mirror_6 = 5
mirror_7 = 4
mirror_8 = 3
mirror_9 = 2
mirror_0 = 1
mirror_y = t
mirror_u = r
mirror_i = e
mirror_o = w
mirror_p = q
mirror_h = g
mirror_j = f
mirror_k = d
mirror_l = s
mirror_n = b
mirror_m = v


;This key may help, as the space-on-up may get annoying, especially if you type fast.
Control & Space::Suspend

;These keys are optional, but they may help if you are typing on the left-hand side.

CapsLock::Send, {BackSpace}
+Capslock::Capslock
;Capslock is backspace and Shift+Capslock works for Capslock.

Space & `::Send, {-}  

Space & CapsLock::Send, {Enter}

If spacebar didn't modify anything, send a real space keystroke upon release.
space::
Send {space}
return

space & 1::
space & 2::
space & 3::
space & 4::
space & 5::
space & q::
space & w::
space & e::
space & r::
space & t::
space & a::
space & s::
space & d::
space & f::
space & g::
space & z::
space & x::
space & c::
space & v::
space & b::
space & `;::
space & ,::
space & .::
space & /::
space & 6::
space & 7::
space & 8::
space & 9::
space & 0::
space & y::
space & u::
space & i::
space & o::
space & p::
space & h::
space & j::
space & k::
space & l::
space & n::
space & m::
;Determine the mirror key, if there is one:
if A_ThisHotkey = space & `;
   MirrorKey = a
else if A_ThisHotkey = space & ,
   MirrorKey = c
else if A_ThisHotkey = space & .
   MirrorKey = x
else if A_ThisHotkey = space & /
   MirrorKey = z
else  ; To avoid runtime errors due to invalid var names, do this part last.
{
   StringRight, ThisKey, A_ThisHotkey, 1
   StringTrimRight, MirrorKey, mirror_%ThisKey%, 0  ; Retrieve "array" element.
   if MirrorKey =  ; No mirror, script probably needs adjustment.
      return
}


Modifiers =
GetKeyState, state1, LWin
GetKeyState, state2, RWin
state = %state1%%state2%
if state <> UU  ; At least one Windows key is down.
   Modifiers = %Modifiers%#
GetKeyState, state1, Control
if state1 = D
   Modifiers = %Modifiers%^
GetKeyState, state1, Alt
if state1 = D
   Modifiers = %Modifiers%!
GetKeyState, state1, Shift
if state1 = D
   Modifiers = %Modifiers%+
Send %Modifiers%{%MirrorKey%}
return
;半键盘模拟器
镜像_1=0
镜像_2=9
镜像_3=8
镜像_4=7
镜像_5=6
镜像q=p
镜像w=o
镜像e=i
镜像r=u
镜像t=y
镜像_a=`;
镜像_s=l
镜像d=k
镜像f=j
镜像g=h
镜像_z=/
镜像_x=。
镜像_c=,
镜像v=m
镜像_b=n
镜像_6=5
镜像_7=4
镜像_8=3
镜像_9=2
镜像0=1
镜像_y=t
镜像
镜像i=e
镜像_o=w
镜像p=q
镜像h=g
镜像j=f
镜像k=d
镜像
镜像n=b
镜像m=v
;这个键可能会有帮助,因为上面的空格可能会让人讨厌,特别是如果你打字快的话。
控件和空间::挂起
;这些键是可选的,但如果您在左手边键入,它们可能会有所帮助。
CapsLock::Send,{BackSpace}
+卡普斯洛克::卡普斯洛克
;Capslock是backspace,Shift+Capslock为Capslock工作。
空间&`::发送,{-}
Space&CapsLock::Send,{Enter}
如果空格键没有修改任何内容,请在释放时发送一个真正的空格键。
空格::
发送{space}
返回
空格&1::
空间&2::
空间&3::
空格&4::
空格&5::
空间与问题:
空间和宽度::
空间与环境:
空间与r::
太空科技::
空格和a::
太空与太空::
空间与发展:
太空飞行::
空间与地理::
空间与z::
空格和x::
空间与通信:
空间与虚拟:
空间食宿::
空格&`;::
空格&,::
空格&.::
空格&/::
空格&6::
空格&7::
空格&8::
空格&9::
空格&0::
空格和y::
空格和u::
空间与i::
空间与操作::
空间与p::
空间和h::
space&j::
空间与k::
空间与l::
空格(&n)::
space&m::
;确定后视镜钥匙(如果有):
如果此热键=空格&`;
镜像键=a
否则,如果此热键=空格&,
MirrorKey=c
否则,如果A_ThisHotkey=space&。
镜像键=x
否则,如果A_ThisHotkey=space&/
镜像键=z
其他的为了避免由于变量名无效而导致的运行时错误,请最后执行此部分。
{
StringRight,这个键,A_这个热键,1
StringTrimRight,MirrorKey,mirror\u%ThisKey%,0;检索“数组”元素。
如果MirrorKey=;无镜像,则脚本可能需要调整。
返回
}
修饰语=
GetKeyState,状态1,LWin
GetKeyState,state2,RWin
状态=%state1%%state2%
如果状态为UU;至少有一个Windows键已关闭。
修饰符=%修饰符%#
GetKeyState,状态1,控件
如果state1=D
修饰符=%修饰符%^
GetKeyState,state1,Alt
如果state1=D
修饰符=%修饰符%!
GetKeyState,状态1,Shift
如果state1=D
修饰符=%修饰符%+
发送%Modifiers%{%MirrorKey%}
返回

请注意,自动热键变量名称不区分大小写。

使用关联数组,而不是关闭
镜像a
等,并包括大写字母

; Associative array that mirrors the left and right side of the keyboard.
keyA    :=  {"1" : "0"
            ,"2" : "9"
            ,"3" : "8"
            ,"4" : "7"
            ,"5" : "6"
            ,"q" : "p"
            ,"w" : "o"
            ,"e" : "i"
            ,"r" : "u"
            ,"t" : "y"
            ,"a" : ";"
            ,"s" : "l"
            ,"d" : "k"
            ,"f" : "j"
            ,"g" : "h"
            ,"z" : "/"
            ,"x" : "."
            ,"c" : ","
            ,"v" : "m"
            ,"b" : "n"
            ,"0" : "1"
            ,"9" : "2"
            ,"8" : "3"
            ,"7" : "4"
            ,"6" : "5"
            ,"p" : "q"
            ,"o" : "w"
            ,"i" : "e"
            ,"u" : "r"
            ,"y" : "t"
            ,";" : "a"
            ,"l" : "s"
            ,"k" : "d"
            ,"j" : "f"
            ,"h" : "g"
            ,"/" : "z"
            ,"." : "x"
            ,"," : "c"
            ,"m" : "v"
            ,"n" : "b"}

; Make Hotkeys
for index, value in keyA
    Hotkey, % "$*" index, FlipFlop, On
return

; Disables space from being sent if it's held down for more than 300ms
$*Space::
    KeyWait, Space, T0.3
    if (ErrorLevel = 1)
        KeyWait, Space
    Else
        Send, {Space}
return

; Removes the hook and wildcard modifiers
FlipFlop:
    StringReplace, hk, A_ThisHotkey, % "$*"
    ; If space is held
    if GetKeyState("Space", "P")
        ; Send the mirror of the keys along with any held modifiers
        Send, % "{Blind}" keyA[hk]
    Else
        ; Send the actual key pressed along with modifiers
        Send, % "{Blind}" hk
return