使用 Autohotkey 减去变量

Oli*_*ryn 3 math autohotkey

我正在 Autohotkey 中构建一个宏,它要求我从变量中减去一个数字,如下所示:

screenWidth = 1280
MsgBox, screenWidth - 150
Run Code Online (Sandbox Code Playgroud)

由于某种原因,每当出现带有消息的对话框时,我得到的只是screenWidth - 150,而不是1130。通过这种方法,我更近了一步:

screenWidth = 1280
MsgBox, %screenWidth% - 150
Run Code Online (Sandbox Code Playgroud)

对于上面的代码,我得到了1280 - 150,但仍然没有数学结果。

根据文档,Price * (1 - Discount/100)假设“价格”和“折扣”都已定义,那么简单的代码应该可以工作。

有人可以指导我我做错了什么吗?

Oli*_*ryn 5

我的错误是,在该方法的文档中MsgBox,我被告知在末尾添加百分号MsgBox会导致它将输入视为表达式。现在MsgBox % screenWidth - 150计算正确。