命令后的逗号有什么作用?

What does the comma after a command do?

AutoHotkey Beginner Tutorial 从使用 Send 命令的示例开始,命令及其参数用逗号分隔:

^j::
   Send, My First Script
Return

...

SEND is the command, anything after the comma (,) will be typed.

后面给出了一个没有逗号的MsgBox命令的例子:

esc::
    MsgBox Escape!!!!
Return

根据实验,似乎包含或省略逗号对命令的行为没有影响,至少在这些简单的情况下是这样。我们可以更改上面两个示例中是否包含逗号,命令仍然有效:MsgBox, Escape!!! 有效,Send My First Script.

也有效

是否存在语法需要逗号(或禁止使用逗号)的情况?包含逗号是否会以任何方式改变命令的语义?为什么允许两种语法?

AutoHotkey 中的逗号 (,) 是分隔符。第一个(在命令和第一个参数之间)是 completely optional in most circumstances:

Tip: The first comma of any command may be omitted (except when the first parameter is blank or starts with := or =, or the command is alone at the top of a continuation section). For example:

MsgBox This is ok.
MsgBox, This is ok too (it has an explicit comma).

为了进一步说明这个问题,引用自commands and commas

There are two ways of writing commands in AHK v1:

; initial commas
Cmd, Arg1, Arg2
Cmd, , Arg2

; no initial commas
Cmd Arg1, Arg2
Cmd , Arg2

The no initial comma style can look a bit odd, confusing even, when you omit the first parameter.