PDA

View Full Version : Set Macro as array type


kodakdave
10-22-2010, 10:15 AM
I had asked Support for a way to set a macro as an array type, the way "Read File" can. Such that one can later process that macro in vbscript and apply such functions as UBound to it.

Their quick and correct answer, that I had been unable to find on the forum, was:

//You can't do that with the Set Macro action, but you can use the Run Script action and the object model to do it:

RunScript action containing:
vbld_TempMacros.Add "ARRAY", Array("hello", "goodbye", "test")

Then, as verification, another
RunScript action containing:
arr = vbld_AllMacros()("ARRAY")
For i = 0 To UBound(arr)
Builder.LogMessage "Value " & i & " = " & arr(i)
Next

If this is already mentioned somewhere in the forum, I apologize. If not, then I wanted others to benefit from the tip as well.