If I set the number into a variable or a message box,then AHk calculates them but if I copy the numbers and use the clipboard as variable,AHk will display them rather than calculate them
Var = 5+5
Msgbox,% var ; displays 5+5
var := 5+5
msgbox,% var ; displays 10
var := Clipboard ; the clipboard contains 5+5
msgbox,% var ; displays 5+5
Var1 = 5+5
var2 := var1
msgbox,% var2 ; displays 5+5
How to calculate a variable that contains digits
Re: How to calculate a variable that contains digits
Re: How to calculate a variable that contains digits
Yes I know that but why AHK can calculate variable with digits with no extra functions but need that code if the calculation is in a variable
Can calculate
Msgbox,% 5+5
Can't calculate and need that extra code to do the calculation
var = 5+5
msgbox,% var
Can calculate
Msgbox,% 5+5
Can't calculate and need that extra code to do the calculation
var = 5+5
msgbox,% var
Re: How to calculate a variable that contains digits
Re: How to calculate a variable that contains digits
https://www.autohotkey.com/docs/Variables.htm#Intro
Code: Select all
;var = TEXT
var = 5 + 5
MsgBox, % var
;var = % Experssion
var = % 5 + 5
MsgBox, % var
;var := "TEXT"
var := "5 + 5"
MsgBox, % var
;var := Experssion
var := 5 + 5
MsgBox, % var