How do you?

Posted by David Berthiaume on Fri 22 Apr 2005 03:28 PM — 4 posts, 19,666 views.

#0
How do you convert a Variable into an Array to import into a script file?
USA #1
Split it up manually, or with a split function, and then join it again to store it to a variable.
#2
codes = Array("^W", "^o", "^^")

That's what I currently have.
What I'd like to be able to do is:
codes = GetVariable("ArrayCodes")

It didn't work when I tried it.
Would this work?
Arraycodes = GetVariable ("ArrayCodes")
codes = Arraycodes
USA #3
You'd have to use the split and join functions.

SetVariable "variable", join(codes,",")
Will set "variable" with "^W,^o,^^", You may also want to use a carriage return as the delimiter, which will also allow you to use it as a MC array if you'd ever like to (as well as providing peace of mind that you won't ever have a color code of "^," or whatever.

And then to get them, you'd use the same Split function:
Split(GetVariable("variable"),VBCrLf)
Will return the array in variable (provided it was joined with VBCrLf (a carriage return)).