I couldn't find any documentation on how to pass the contents of an array from Macroscript code to VBScript. The following post contains an explanation of how to get an array out of VBScript:
http://www.mjtnet.com/usergroup/viewtopic.php?t=1151
Is it also necessary to make a delimited string, and if so what's the easiest way to uncouple it in VBscript?
[ I am trying to send the contents of a Macroscript array to a database ]
Bill.
How to send an Array to VBScript
Moderators: JRL, Dorian (MJT support)
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Since MacroScript arrays are not the same as VBScript arrays you'd need to populate each element one at a time. So you just need a loop that loops through your array, with a VBEVal statement inside assigning the value to the corresponding VBScript array element.
You don't need to "decouple" strings. VBScript wants them delimited. Just put quotes round them when you send into VBScript and VBScript handles the rest. If a string contains a quote char then double quote it. Use StringReplace to replace all occurrences of " with "".
You don't need to "decouple" strings. VBScript wants them delimited. Just put quotes round them when you send into VBScript and VBScript handles the rest. If a string contains a quote char then double quote it. Use StringReplace to replace all occurrences of " with "".
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Thanks marcus
I ended up passing a string and using the VB split() command to assign t he values to an array. Here is the code if anyone is interested. It works OK for numbers and only for one-dimensional arrays I guess.
[/code]
I ended up passing a string and using the VB split() command to assign t he values to an array. Here is the code if anyone is interested. It works OK for numbers and only for one-dimensional arrays I guess.
Code: Select all
VBSTART
Sub SendArray(DataText)
Dim MyArray
MyArray = Split(DataText, " ", -1, 1)
MsgBox(MyArray(0) & ", " & MyArray(1) & ", ...")
End Sub
VBEND
VBRun>SendArray,15 20 25 30 35 40 45