Reputation: 3
var1 := "this works"
#If WinActive("")
d::d
#If
var2 := "this doesn't"
x::
MsgBox, %var1%, %var2%
return
When the hotkey is triggered, it only displays var1, acting like var2 doesn't exist at all.
Why does this happen and what can I do to access var2 from the hotkey?
I can't move var2 up, since my actual code is split accross two files.
Upvotes: 0
Views: 132
Reputation: 10543
You cannot define a variable between or after hotkeys or hotstrings. Hotkeys/Hotstrings terminate the automatic execution of code lines and the line
var2 := "this doesn't"
never becomes true because is never executed.
A variable has to be defined
Upvotes: 2