Code: Select all
Loop 5
var%A_Index%:=5*A_Index
MsgBox % var1 "`n" var2 "`n" var3 "`n" var4 "`n" var5
But I'm trying to adapt this situation into a GUI on v2 and it's not liking it
Code: Select all
#Requires Autohotkey v2
#SingleInstance
global increment
increment:=1
myGui:=Gui("","Test")
additionGui:=myGui.Add("Button","","+")
additionGui.OnEvent("Click",AddMoreControls)
levelTitle:=myGui.Add("Text","x0","Placeholder")
myGui.Add("Edit","x0 w40 vExample%increment%","")
myGui.Show() ; Gui, Main:Show
return
AddMoreControls(*){
global increment
increment:=increment+1
myGui.Add("Edit","x0 w40 vExample%increment%","")
myGui.Show("Autosize") ; Gui, Main:Show, Autosize
}
#r::reload
This makes me think that now it's being read as truly literal "vExample%increment%" with percent signs in name, that it's not getting vExample1 on the initial control and each press of the button it's not giving it vLevel2 or vLevel3, but increment is indeed increasing.Error: A control with this name already exists.
Specifically: Example%increment%
015: {
017: increment := increment+1
▶ 018: myGui.Add("Edit","x0 w40 vExample%increment%","")
019: myGui.Show("Autosize")
020: }
It's not clicking for me on what I should do for the & operator. Do I need to set up thousands of manual Example1 through Example9999 or whenever I get bored of typing or running a script to try typing it out for me and then somehow reference using the & to those?? It gets more complicated trying to shove these into the AHK v2 GUIs. Was easily done on v1 for me, but I'm trying to my best to adapt to v2 and use its new functionality. It's probably really simple, but if I can get just an example I can make heads or tails of it. Thanks!