如何在 AutoHotkey 中将短语用作 HotString - 包括 HotString 中的空格

How to use a phrase as HotString in AutoHotkey - including spaces in HotString

有没有办法在 HotString 中包含 space 并且仍然让 space 触发 HotString 替换?例如:

::_u_::_you_  <--where the underscores are actually space chars

:*:_fo_r::_for_  <--where the underscores are actually space chars

所以如果我输入

Whosebug is a great place fo ranswers!

将改为

Whosebug is a great place for answers!

我正在寻找一种真正将短语定义为热字串的方法。

奇怪。我尝试使用 `s 进行转义,但这没有用。 docs 说两件事:

To send an extra space or tab after a replacement, include the space or tab at the end of the replacement but make the last character an accent/backtick (`). For example:

:*:btw::By the way `

Spaces and tabs are treated literally within hotstring definitions. For example, the following would produce two different results: ::btw::by the way and ::btw:: by the way

所以,我认为这应该可行:

:*: fo r:: for ` 

这在记事本中有效,但前提是我在一行的开头尝试它。中句失败了。

您可能被迫使用用户创建的动态正则表达式热字符串库之一。

使用 this library,这有效:

#include Hotstring.ahk
Hotstring(" fo r", " for ")

编辑:

我在 AHK 论坛上问过,? 选项应该可以:

:*?: fo r:: for `

这会起作用。

:*: fo r::
SetKeyDelay, -1
Send for{space}
return