简体   繁体   English

允许按下禁用键的热键

[英]Allow hotkey that presses a disabled key

My keyboard key/letter f is ruined and continuously presses the letter.我的键盘键/字母f已损坏并连续按下字母。 I am using AutoHotKey to successully disable the letter, but I need an alternative hotkey to press the key.我正在使用 AutoHotKey 成功禁用该字母,但我需要一个替代热键来按下该键。 I have chosen to use CTRL+j as the hotkey to press the letter f .我选择使用CTRL+j作为按下字母f的热键。 I tried this script but it does not seem to press the key:我试过这个脚本,但它似乎没有按下键:

f::return

^j::
Send f
return

I also tried this but it also does not work:我也试过这个,但它也不起作用:

f::return

^j::
Send {f down}
return

How can I get the script to press f using the hotkey CTRL+j , while disabling the key f ?如何让脚本使用热键CTRL+j按下f ,同时禁用键f

The $ modifier is going to solve this problem. $修饰符将解决这个问题。
That modifier makes it so that your f::return hotkey wont affect keys that are sent from AHK.该修饰符使您的f::return热键不会影响从 AHK 发送的键。

So here's your finished script:所以这是你完成的脚本:

$f::return
^j::SendInput, f

Also switched over to SendInput due to it being the recommended faster and more reliable send mode.也切换到SendInput,因为它是推荐的更快、更可靠的发送模式。

I used the ASCII code for the letters in both uppercase and lowercase, and it also worked:我对大写和小写字母都使用了ASCII 代码,它也有效:

; disable the key 'f':
f::return

; press CTRL+j to press f:
^j::
Send {Asc 102}
return

; press CTRL+Shift+j to press F:
^+j::
Send {Asc 70}
return

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

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