Dynamic global variable for GUI,Add

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
dsewq1LYJ
Posts: 116
Joined: 26 Aug 2014, 23:21

Dynamic global variable for GUI,Add

21 Dec 2018, 04:22

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:

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: AlFlo and 218 guests