在 AHK MsgBox 的单独代码行上具有文本参数

Having text parameters on seperate lines of code for AHK MsgBox

我 运行 遇到了当前脚本的一个小问题。这很有趣,因为我才刚刚开始制作它,但我离题了。我正在尝试制作一个 AHK,它只是通过 MsgBox 告诉我所有的热键。因此,我希望每个命令都列在它们自己的 code 行中。我会把我的意思写在下面。

截至目前,我有这个:

1| AppsKey & H::
2|     MsgBox, 4, Commands, {
3|         Apps + H - Opens this help box `n
4|         Apps + C - Opens something. `n
5|         Apps + P - Opens something else `n
6|         Apps + T - Opens one more thing
7|         }
8|
9| Return

遗憾的是,这不起作用,并且 returns 错误说明:

Line Text: Apps + H - Opens this help box `n
Error: This line does not contain a recognized action

到目前为止,我已经尝试过使用圆括号、大括号和引号。我想知道是否有可能在单独的代码行中使用文本参数。如果没有,我是否需要 to/should 我为此使用 GUI?也许我可能只是有点挑剔,但我有很多热键需要列出,所以希望我可以将它整理得井井有条,这样下次我添加更多命令时就不会让我头疼了。

我查看了一些 AHK 的示例和一些 google,但大多数结果只是解释 Text`nMoreText 在 MsgBox 本身中创建了一个新行。并且类似的问题与AHK或MsgBox无关。所以我很感激你的帮助。

而且,一如既往,感谢您抽出宝贵时间阅读本文,感谢您的所有答复。如果您有任何问题或想要求详细说明,请随时提出。再次感谢您的宝贵时间。

要将命令(在本例中为 MsgBox 命令)的参数拆分为多行,您需要使用 continuation section:

AppsKey & h:: ; do not use capital letters in hotkey definitions. They produce a different effect in some programs
text =
(
Apps + H - Opens this help box `n
Apps + C - Opens something. `n
Apps + P - Opens something else `n
Apps + T - Opens one more thing
)
MsgBox,, Commands, %text%
Return