问题描述
我有一个似乎无法一起使用的热键和热字符串:
I have a hotkey and hotstring that don't seem to work together:
9::(
:?ob0:(::){left 1}
为了提供上下文,我在代码的一部分中将所有符号重新映射到它们下面的数字,反之亦然,因此9
打印了括号(
.稍后,我放了一个热字符串,该字符串将在打开的括号后键入一个闭合的括号,然后将光标置于它们之间.
To give some context, in one part of the code I remapped all the symbols to the number below them and vice versa so 9
prints the parenthesis (
. Later on I put a hotstring that would type a closed parenthesis after an open one and then places the cursor in between.
看起来很简单,因为它们都可以单独工作,但是当我按9
键并按空格键时,它们可以一起工作,我只得到了打开的括号(
,好像忽略了热字符串.
Seems simple enough because they both work individually but together when I press the key for 9
and press the Spacebar I only get the open parenthesis (
as if the hotstring was ignored.
我缺少明显的东西吗?
推荐答案
尝试结合使用 Send
和 InputLevel
.
Try using a combination of Send
and InputLevel
.
#InputLevel 1
9::SendEvent (
#InputLevel 0
;; Add closing parenthesis
:?ob0:(::){left 1}
说明
-
Explanation
#InputLevel
- 默认情况下,挂钩热键和热字符串会忽略由任何AutoHotkey脚本.可以使用 SendLevel 或#InputLevel
- 通过将
9
热键设置为更高的InputLevel,它可以激活其他热字符串.
- By default, hook hotkeys and hotstrings ignore keyboard and mouse events generated by any AutoHotkey script. This behavior can be overridden using SendLevel or #InputLevel
- By setting the
9
hotkey to a higher InputLevel, it is able to the activate other hotstrings.
- 很高兴地,将数字键重新映射为其当
#InputLevel 1
处于活动状态时,+ 等效项没有输入.- 即无法使用
1::!
,2::@
,3::#
,...,8::*
,9::(
等. - 使用了发送命令来解决此重新映射限制 strong>
- Bizarrely, remapping a numkey to its + equivalent produced no input when
#InputLevel 1
was active.- i.e. Couldn't use
1::!
,2::@
,3::#
, ...,8::*
,9::(
, etc. - A Send command was used to workaround this remapping limitation
- SendPlay 不受 InputLevel .
- 重新映射键的注释可以解释为什么
9::(
不会的原因触发其他热键.- "尽管重新映射的键可以触发普通的热键,但是默认情况下它不能触发鼠标热键或挂钩热键."
- SendPlay is not affected by InputLevel.
- Remarks for Remapping Keys may explain why
9::(
wouldn't trigger other hotkeys.- "Although a remapped key can trigger normal hotkeys, by default it cannot trigger mouse hotkeys or hook hotkeys."
这篇关于重新映射键的热键不会触发热字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
- i.e. Couldn't use
- 即无法使用