本文介绍了重新映射键的热键不会触发热字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个似乎无法一起使用的热键和热字符串:

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}


说明

  • #InputLevel


    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.

      SendEvent

09-11 22:54