简体   繁体   English

将Alt +`重新映射到ESC

[英]Remapping Alt+` to ESC

My Esc key is broken on my keyboard, and I would like to remap it to Alt + ` (that's Alt and ` grave accent, same button as the ~ tilde). 我的Esc键在键盘上已损坏,我想将其重新映射为Alt + ` (即Alt`重音符号,与波浪号相同的按钮)。 However: 然而:

!`::Esc

will trigger Alt + Esc when pressed (! Esc ) because the Alt key is held down. 因为按住Alt键,将在按下(! Esc )时触发Alt + Esc How do I remap Alt + ` so that, when pressed, it will trigger Esc rather than Alt + Esc ? 如何重新映射Alt + `,以便在按下时将触发Esc而不是Alt + Esc

EDIT: I am not opposed to using an entirely different program to remap my keys. 编辑:我不反对使用完全不同的程序来重新映射我的密钥。 I just want to remap ALT + ` to the Esc key in all of my Windows. 我只想在所有Windows中将ALT + `重新映射到Esc键。

Use SendPlay : 使用SendPlay

!`::sendplay {Esc}

SendPlay [...] buffers any physical keyboard or mouse activity during the send, which prevents the user's keystrokes from being interspersed with those being sent. 在发送过程中,SendPlay会缓冲任何物理键盘或鼠标活动,从而防止用户的击键散布在发送的键盘或鼠标中。

I found two possible ways to achieve this. 我发现了两种可能的方法来实现这一目标。


Use BlockInput 使用BlockInput

Disables or enables the user's ability to interact with the computer via keyboard and mouse. 禁用或启用用户通过键盘和鼠标与计算机进行交互的功能。

!p::
    BlockInput On
    send {Esc}
    BlockInput, Off
return

You might need to run the script as administrator and the alt and/or p may get stuck down, which led me to the second solution. 您可能需要以管理员身份运行脚本,并且alt和/或p可能会卡住,这导致我转向第二种解决方案。


Use KeyWait 使用KeyWait

Waits for a key or mouse/joystick button to be released or pressed down. 等待按键或鼠标/操纵杆按钮释放或按下。

!p::
    KeyWait, Alt
    send {Esc}
return

This should work: 这应该工作:

!`::
    SendInput, {Alt Up}{Esc}
Return

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM