简体   繁体   English

自动热键将韩语键重新映射为Ctrl

[英]AutoHotkey Remapping Korean Keys to Ctrl

There are two keys adjacent to the spacebar on standard Korean keyboards (one on each side) which I would like to remap to be Control or Alt modifiers - so I can alternate using a stronger finger than my pinky (I'm an emacs user). 我想将其重新映射为Control或Alt修饰符,而标准韩文键盘上的空格键旁边有两个键(每侧一个)-因此,我可以使用比小指强的手指来代替(我是emacs用户) 。

I'm guessing the problem is that they do not seem to generate a KeyUp event, and they don't repeat like other keys. 我猜问题是,他们似乎并没有 产生一个KeyUp事件,他们喜欢重复其他键。 I've got a hacky solution that is terrible involving a loop using autohotkey. 我有一个骇人听闻的解决方案,涉及使用autohotkey进行循环很糟糕。 Also did something similar with another non-free program, KeyManager. 另外,另一个非自由程序KeyManager也做了类似的操作。 I'm hoping for some more advanced trickery or workarounds (AutoHotkey, drivers or otherwise). 我希望有一些更高级的技巧或解决方法(AutoHotkey,驱动程序或其他)。

;Scan Code for Hanja Key
sc1F1::
Loop 10000
{
SetKeyDelay,-1
Send {Blind}{LCtrl DownTemp}
}
SetKeyDelay,-1
Send {Blind}{LCtrl Up}
Return

Keyboard Hook Output of Pressing (and holding) Hanja : 按下并按住Hanja的键盘挂钩输出:

You can see there is no repeat and no up event. 您可以看到没有重复也没有向上事件。

VK  SC  Type    Up/Dn   Elapsed Key     Window
74  03F     u   0.08    F5              
19  1F1     d   0.66    Hanja           
74  03F     d   9.58    F5       

Updates: 更新:

Tried: 尝试过:

sc1F1 & t::Send {Blind}{LCtrl DownTemp}{t}{LCtrl Up}

Results: 结果:

After pressing Hanja + t , the hotkey fires, but then subsequent presses of ONLY t alone perform the same action. 按下Hanja + t后 ,将触发热键,但随后 单独按下t会执行相同的操作。 LCtrl Up doesn't appear to occur. LCtrl Up似乎没有发生。

Abe's SetTimer based reset is nice though! 安倍基于SetTimer的重置虽然不错! feels like a more elegant version of my original code. 感觉像是我原始代码的更优雅的版本。 However, the catch is the delay - I have to pace my input speed to match the delay. 但是,问题在于延迟-我必须调整输入速度以匹配延迟。

Other tested solutions: 其他经过测试的解决方案:

GetKeyState("vk19", "p") always reports PRESSED after script loads and one initial press. 在加载脚本和第一次按下后GetKeyState("vk19", "p")始终报告PRESSED。 It never breaks this state - even long after i have released the key. 它永远不会破坏这种状态-甚至在我释放密钥很长时间之后。

KeyWait also doesn't work as intended. KeyWait也无法正常工作。

sc1F1 up::traytip,, test also does not produce a traytip after any number of press/releases. sc1F1 up::traytip,, test在按任意数量的释放键后sc1F1 up::traytip,, test也不产生traytip。

Assem, 大会,

I have not yet finished this thought, but would this be an alternative approach? 我还没有完成这个想法,但是这会是替代方法吗? It will show you which keys are pressed until (in this case an enter is pressed), but you can maybe create your own "finish" condition and then "combine" the key presses to create your Alt or Ctrl combinations. 它会向您显示直到按下(在这种情况下,按Enter键)之前要按下的键,但是您可以创建自己的“完成”条件,然后“组合”按键来创建Alt或Ctrl组合。

sc038:: ; Start when (in this case) the left Alt is pressed, {LAlt} is NOT listed in the input list....
input:=""
   Loop
   {
        Input, in, L1, {Enter}{LControl}{RControl}{RAlt}{LShift}{RShift}{LWin}{RWin}{AppsKey}{F1}{F2}{F3}{F4}{F5}{F6}{F7}{F8}{F9}{F10}{F11}{F12}{Left}{Right}{Up}{Down}{Home}{End}{PgUp}{PgDn}{Del}{Ins}{BS}{Capslock}{Numlock}{PrintScreen}{Pause}
        EL=%ErrorLevel%
        ToolTip, %EL% and %in% and %A_ThisHotkey%
        if EL = EndKey:Enter
        {
            ToolTip
            Sleep, 5000
            Break
        }
   }
Return

Have the script send {Ctrl down} 让脚本发送{Ctrl down}
and then set a timer to run a subroutine after a desired amount of time (600ms in the example) 然后设置一个计时器,以在所需的时间(示例中为600ms)后运行子例程
(the - makes it only run once) (-使它仅运行一次)
to send {Ctrl up} : 发送{Ctrl up}

sc1F1::
Sendinput, {Ctrl Down}
SetTimer, Reset, -600
Return

Reset:
Sendinput, {Ctrl Up}
Return

→SetTimer← →设置计时器←


If you wanted to make it a toggle button, 如果您想使其成为切换按钮,
ie press it once and x sends Control + A , 即按一次,x发送Control + A
then press it again to return x to normal behavior: 然后再次按它可以使x恢复正常状态:

sc1F1::Flag:=!Flag

#If Flag
x::Sendinput, ^a
a::Sendinput, test
#If

The value of variable Flag is reversed with every press of sc1F1 , 每次按下sc1F1都会反转变量Flag的值,
ie Flag is either set to 1 or 0. 即标志设置为1或0。
#If Flag is shorthand for #If Flag = 1 #If Flag#If Flag = 1简写
This example requires Autohotkey_L (newer/recommended version) because it uses the #If command. 本示例要求使用Autohotkey_L (较新/推荐的版本),因为它使用了#If命令。

Using AHK basic it would look like: 使用AHK basic,它看起来像:

sc1F1::Flag:=!Flag

$x::
if Flag
    Send, ^a
Else
    Send, x
Return

Other options/examples using 其他选项/示例使用
Capslock in place of sc1F1 : 用大写锁定代替sc1F1

You could try using & if you just want to use the button as a modifier. 如果您只想将按钮用作修饰符&则可以尝试使用&
This example turns Capslock into a modifier (the first line keeps the capslock light off): 此示例将Capslock变成修饰符(第一行使Capslock保持熄灭状态):

SetCapsLockState, AlwaysOff

capslock & x::traytip,, %a_thishotkey%

If you want Capslock to send something when pressed alone 如果您希望Capslock单独按下时发送东西
you will need to add something like: 您将需要添加以下内容:

capslock::Send, something

and then that will only then 'something' on the release of Capslock . 然后这只会在Capslock 发行时“有所作为”。

→Additional information← →其他信息←


Here is an example where X and A perform differently if Capslock is physically ("p") held down: 这是一个示例,如果按住Capslock (“ p”)时XA的执行情况不同:

SetCapsLockState, AlwaysOff
#If GetKeystate("capslock","p")
x::traytip,, %a_thishotkey%
a::traytip,, %a_thishotkey%
#If

You could also try setting a variable ("Flag"), 您也可以尝试设置变量(“标志”),
and then clearing it with a timer. 然后使用计时器清除它。

capslock::
Flag := 1
SetTimer, Reset, 600
Return

Reset:
Flag := 0
Return

#If Flag
x::Sendinput, ^a
a::Sendinput, test
#If

Manual reference: 手册参考:
#If #如果
GetKeyState() GetKeyState()


Another option is installing a keyboard hook. 另一种选择是安装键盘挂钩。
Then you can check what the last pressed key was with the built-in variable: a_priorkey 然后,您可以使用内置变量检查最后按下的键是什么: a_priorkey

#InstallKeybdhook

x::
if (a_priorkey = "Capslock") {
    Traytip,, %a_thishotkey%
} Return

→More on built-in variables← →有关内置变量的更多信息←


If all else fails you could try: 如果其他所有方法都失败,则可以尝试:
Remapping via the Registry's "Scancode Map" 通过注册表的“扫描代码图”重新映射

Maybe I didn't understand the question correctly, but I found key special codes for those keys and this did the trick for me: 也许我没有正确理解这个问题,但是我找到了那些键的特殊键代码,这对我有用:

SC11D:: RCtrl
SC138:: RAlt

Not sure who would use the Alt remap, but for the sake of completeness... 不确定谁会使用Alt重新映射,但出于完整性考虑...

Works using Korean Microsoft IME on Win8. 在Win8上使用朝鲜语Microsoft IME可以工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在使用自动编程器重新映射Alt / Ctrl / Win时,使用罗马尼亚程序员布局键入罗马尼亚字符后,Windows变得疯狂 - Windows going crazy after typing Romanian characters using a Romanian Programmers layout while remapping Alt/Ctrl/Win with Autohotkey 在注册表中为单个用户重新映射密钥 - Remapping keys for single user in Registry 在AutoHotKey中绑定到Ctrl-Shift - Binding to Ctrl-Shift in AutoHotKey 如何使用自动热键更改 Windows 10 中更改桌面的键? - How can I change the keys to change desktop in windows 10 with autohotkey? 使用自动热键将大写锁定键重新映射到修改键ctrl + shift + alt - Remap capslock-key to modifier key ctrl+shift+alt with Autohotkey 使用自动热键(W7 Pro SP1)将“ Ctrl + 1”重新映射为“ Alt + d” - Remap “Ctrl+l” to “Alt+d” with Autohotkey (W7 Pro SP1) 键盘重映射 - Keyboard remapping R中的韩文编码问题 - Korean encoding issues in in R 可以将Shift,Ctrl,Alt或Win键之一用于其他目的,例如键入文本吗? - Can one of the Shift, Ctrl, Alt or Win keys be used in other purpose like, to type text? Windows 键盘键的 ascii 代码和功能键 (F1 - F12) 和其他键(如 shift、capslock、backspace、ctrl 等)的代码 - ascii codes for windows keyboard keys and the codes for function keys(F1 - F12) and other keys like shift,capslock,backspace,ctrl etc
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM