Kinook Software Forum

Kinook Software Forum (https://www.kinook.com/Forum/index.php)
-   [VBP] General Discussion (https://www.kinook.com/Forum/forumdisplay.php?f=2)
-   -   Accessing macro array elements (https://www.kinook.com/Forum/showthread.php?t=5226)

Tony2 01-15-2014 01:36 PM

Accessing macro array elements
 
Hi all

So I have a step which reads a file using a regex and matches 4 groups.
I have the option "Store matching groups in array"
And the macro it is going in is named DATABASE

If I log %DATABASE% to the output then I get 4 lines containing the information.
I need to be able to access each element individually so that I can run a command line putting the right elements in the right places....

How do I do this, I can't find anything on accessing a macro array in the help....

Thanks

kinook 01-15-2014 01:52 PM

1 Attachment(s)
See the attached sample for how to access via a Loop action or Run Script action.

Tony2 01-15-2014 02:10 PM

Thanks..

So no way to do %macro[1]% or something? I'm already in a loop so would now have nested loop and another 4 macros....

I'm almost thinking of having 4 different steps each matching one of the four groups I currently have. Would look less messy.

kinook 01-15-2014 02:20 PM

Define a project or global script function like so:

Code:

Function ArrayElem(name, index)       
        a = vbld_TempMacro(name)
        ArrayElem = a(index)
End Function

and call like this in a Run Script step:

Builder.LogMessage ArrayElem("DATABASE", 0)

or like this in a field:

[ArrayElem("DATABASE", 0)]

http://www.kinook.com/VisBuildPro/Ma...ripteditor.htm
http://www.kinook.com/VisBuildPro/Ma...xpressions.htm


All times are GMT -5. The time now is 05:06 PM.


Copyright © 1999-2023 Kinook Software, Inc.