How do I send the value of an array variable in Autohotkey?

Viewed 8926

I'm writing an AutoHotkey script which needs to display the value of an array variable, but it doesn't seem to be working properly.

MyArray := ["one", "two", "three"]

send MyArray[1]     ; "MyArray[1]"
send MyArray%1%     ; "MyArray"
send %MyArray1%     ; <empty>
send % MyArray%1%   ; <empty>
;send %MyArray%1%   ; 'Error: Variable name missing its ending percent sign'
;send %MyArray%1%%  ; 'Error: Empty variable reference (%%)'
;send %MyArray[1]%  ; 'Error: Variable name contains an illegal character'

I've found posts on the AHK forums claiming I can use send %MyArray1% or send % MyArray %1%, but both commands just reference empty variables.

How do I send an array's value in an AutoHotkey script?

1 Answers
Related