【问题标题】:Subtracting Variables with Autohotkey使用 Autohotkey 减去变量
【发布时间】:2011-10-22 05:47:48
【问题描述】:

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

screenWidth = 1280
MsgBox, screenWidth - 150

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

screenWidth = 1280
MsgBox, %screenWidth% - 150

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

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

有人可以告诉我我做错了什么吗?

【问题讨论】:

    标签: math autohotkey


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-04-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-19
      • 2013-04-20
      • 2012-01-13
      相关资源
      最近更新 更多