Dynamic global variable for GUI,Add

Get help with using AutoHotkey and its commands and hotkeys
dsewq1LYJ
Posts: 114
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”

Who is online

Users browsing this forum: Google [Bot], thomas1906 and 271 guests