Page 1 of 1

Dynamic global variable for GUI,Add

Posted: 21 Dec 2018, 04:22
by dsewq1LYJ
My first attempt

Code: Select all

global vars := []
, vars_i := 0
add("foo")
add(var) {
  vars.Push(var)
  vars_i++
  alias := vars[vars_i]
  Gui,mc:Add,Text,V%alias%
}
it cause error :
Error: A control's variable must be global or static.
so I google "ahk dynamic global variable" on google.
It turns out I can use "global local" to solve this issue,
but it stil feedback another error

I've tried

Code: Select all

    global %alias%

Code: Select all

    global
    local %alias%
Any idea =(
This took me a really long time :headwall: