Variable within a variable?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
iknoididitwrong
Posts: 1
Joined: 08 Dec 2021, 18:08

Variable within a variable?

08 Dec 2021, 18:10

Hi all, is this possible? If not what should I modify?

----------------------------

Code: Select all

#SingleInstance, Force

var1 := I am having a %var2% day

InputBox, var2

MsgBox,,,%var1%
return
[Mod edit: [code][/code] tags added.]
User avatar
boiler
Posts: 16925
Joined: 21 Dec 2014, 02:44

Re: Variable within a variable?

08 Dec 2021, 18:19

var2 must contain its value before you assign it and other stuff to v1, and don’t use the expression assignment operator := if you’re going to then use legacy syntax.

Code: Select all

#SingleInstance, Force

InputBox, var2

var1 = I am having a %var2% day

MsgBox,,,%var1%
return

Using the expression assignment operator:

Code: Select all

var1 := "I am having a " var2 " day"

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Lamron750, nacken012 and 228 guests