21i9r2017 ‘tring ~sutohotkey assign 3 text expression to a variable Stack Overtow
Learn, Share, Build
Each month, over 50 milion developers come to Stack Overflow to
4 bul th
their knov reer,
Join the world’s largest developer community
autohotkey assign a text expression to a variable
Want to
Gilat
In an autohotkey crn was trying fo assign a tox sng oa atible. Can anyone spot why this doesn work, i ooks ust ike some provided
‘examples? I dort need the variable anymore, bul raw Im just curious wha ci wrong
‘myuar = % “ot ;eretes global variable myvar, buthas no contents
now you cou jst say myvar= foo but leaving quotes of fed text string just makes me cringe. | even het working but didnt save my fle
before making'a few harmiess cosmetic edi elck onthe *H ask con near the clock use menu Fle/ show vavibles to vey the empty
contents,
gor
1 Answer
‘Okay, so wo assign a vale o a variable:
Iryou do ithis way, you just read the contents ofthe variable:
stor Reval MSE jshorny
(Ofcourse, here, he tox i not evaluated - "eval this is ust ext to abk
stboxevsthis i+ esl this
‘Ths method called a “Forced Expression” - which Is what you ate loki todo. es to
athe tox sing as It wore code. tis reacng the contents of any variable, tis looking at
the txt and forcing to bacoms a variable (isso of tho sam thing, but not realy)
nephoe x salts is tarry
‘This also gots us harry, and you can soe how we ae reading the varable:
sopoc tees patery
‘Same thing, sere approach (orcing the text to become a variable)
CConside this, whore we free both text sings into thei actual values
htpsistackovertow.com/quostions/17488589/avtohotkey-assign-2-tox-oxprossion4o-a-variable/1 749869841 7498698
4221i9r2017
‘tring ~autohotkey assign 3 text expression to a variable - Stack Overtow
‘Okay, row thal you've gota that. hes is a practical application. We wlfore the value ofthe
text sting to boa variable. Since we've actually defined what alert", ton the gosub wil call
thal defiiton. Pop this ita a seept and unit
byCader
htpsistackovertow.com/quostions/17488589/avtohotkey-assign-2-tox-oxpression4o-a-variable/1 749869841 7498698
22