I am building a macro in Autohotkey which requires me to subtract a number from a variable, as shown below:
screenWidth = 1280
MsgBox, screenWidth - 150
For some reason, whenever the dialog box appears with the message, all I get is screenWidth - 150, instead of 1130. I get one step closer with this approach:
screenWidth = 1280
MsgBox, %screenWidth% - 150
For the above code, I get 1280 - 150, but still no the mathematical result.
According to the documentation, code as simple as Price * (1 - Discount/100) should work, assuming that "Price" and "Discount" are both defined.
Could someone direct me as to what I am doing wrong?
My mistake, in the documentation of the MsgBox method, I am told that adding a percent sign to the end of MsgBox causes it to see the input as an expression. So MsgBox % screenWidth - 150 is now computed correctly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With