简体   繁体   English

自动热键:重新映射Ctrl + {

[英]Autohotkey: remap ctrl + {

I want ctrl + { to work as the home key. 我想按Ctrl + {作为主键。 This doesn't work: 这不起作用:

^{::Send {Home}

I guess the { needs to be escaped? 我猜{需要逃脱吗?

This also doesn't work: (it generates an error on loading the script) 这也行不通:(加载脚本时会产生错误)

^{{}::Send {Home}

What is the correct way of doing this? 正确的做法是什么?

You can use the steps listed here to find the scan code and virtual key code of the { and then use either of those ( SCnnn or VKnn ) in the hotkey definition. 您可以使用此处列出的步骤查找{的扫描代码和虚拟密钥代码,然后在热键定义中使用其中的任何一个( SCnnnVKnn )。

Even though that works I was curious why the ^{ doesn't work for your layout, so I tried using it and seeing if AHK's key history showed { , which it does. 即使这样行​​之有效,我很好奇为什么^{不适用于您的布局,所以我尝试使用它,看看AHK的关键历史记录是否显示{ ,它确实如此。 I took a look at AHK's source code to see what's happening, and I think it comes down to the return value of VkKeyScanEx called with { and your layout, which is 0x0634, ie, AltGr + 4 . 我查看了AHK的源代码以了解发生了什么,我认为这VkKeyScanEx使用{和您的布局调用的VkKeyScanEx的返回值,即0x0634,即AltGr + 4 I hadn't noticed that AltGr + 4 , AltGr + 5 , and AltGr + 9 all produce { in your layout before this, so I tried the ^{ hotkey again and sure enough it fires with AltGr + 4 . 我没有注意到AltGr + 4AltGr + 5AltGr + 9在此之前都在您的布局中产生{,因此我再次尝试了^{热键,并确保它可以在AltGr + 4时触发。 So it seems it's just a limitation of VkKeyScanEx : even if multiple combinations map to some character only one of them can be returned. 因此,这似乎只是VkKeyScanEx一个局限 :即使多个组合映射到某个字符,也只能返回其中一个。 In your .klc file, wherever LEFT CURLY BRACKET first appears will be the combination that VkKeyScanEx returns. 在您的.klc文件中,第一个出现“ VkKeyScanEx括号”的位置将是VkKeyScanEx返回的组合。 I don't know if you use the AltGr combinations for {, but if you remove them from your layout the ^{ hotkey should work for just Ctrl + { . 我不知道您是否对{使用AltGr组合,但是如果从布局中删除它们,则^{热键应该只对Ctrl + {起作用。

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

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