循环遍历 autohotkey 上的对象

looping through object on auto hot key

我如何遍历每种颜色,以便当我第一次按 ctr j 时,它会出现 "red" 第二次 "blue" 等等。 这是我目前所拥有的

^j::
colors := Object("red","blue","green", "black")
for key, in colors
    s .= key 
Send, % s
Return

但是,当我 运行 它时,我得到的输出是

greenredgreenredgreenredgreenredgreenred
; Creating an array: 
colors := ["red","blue","green","black"]
; or: 
; colors := Array("red","blue","green", "black")

;  MaxIndex returns the number of items: 
MaxIndex := colors.MaxIndex()

^j::
    Index++ ; increases the number in the variable "Index" by 1, each time you press ^j.
    Send, % colors[Index]
    If (Index = MaxIndex)
        Index = 0 ; reset
return

https://autohotkey.com/docs/Objects.htm#Usage_Simple_Arrays