PDA

View Full Version : Looping through macro


jnapier
05-27-2005, 11:37 AM
This posts how to loop through the values in a text file http://www.kinook.com/Forum/showthread.php?threadid=231

but what about looping through the values in a macro? I have a macro that contains file names , one on each line. This macro was created from %LASTSTEP_OUTPUT%.

I then want to process each of these files that the macro contains. vbld_NextDelimValue() works on a tab delimited macro, so I am assuming that I need to loop through my original macro and create a tab delimited macro with vbld_AddDelimValue, but I can't figure out how to loop through the original macro.

Thanks for any help.

kinook
05-29-2005, 07:10 AM
One option would be to replace newlines with tab chars when initializing your macro. A Run Script step with VBScript code of:

' store last step output, replacing newlines with tabs for compatibility with vbld_NextDelimValue
Application.Macros(vbldMacroTemporary).Add "MY_MACRO", Replace(Application.Macros(vbldMacroSystem)("LASTSTEP_OUTPUT"), vbCrLf, vbTab)

would do it.

Another option would be to copy the vbld_NextDelimValue system script function to project or global scripts, rename it and tweak for your needs (i.e., use vbCrLf instead of vbTab).

jnapier
05-30-2005, 03:19 PM
I got this error when running the specified script

Error at Line 1, Column 1 (Object variable not set)

kevina
05-30-2005, 06:45 PM
Not sure without seeing your code, but attached is a complete sample that demonstrates the process you want to use.

jnapier
05-31-2005, 01:19 PM
Thanks.
Everything is working as expected.