Parsedata

Started by Secondlaw, January 02, 2018, 11:22:17 AM

Previous topic - Next topic

Secondlaw

Been a while since I've used Winbatch but I've been requested to create a fairly simple script but I'm stuck at one part.

Essentially, I'm parsing a string.  "param0" is the number of values.  I'm attempting to use each value in a "for/while" sequence.

I figured if I used this simple code, I could pass a "COUNT" variable to the the end of each PARAM.
Example:

Whereas the values for all Param variables would be filenames:

count=1
for x=count to Param0
Filename=strcat("param",count)
COpy (filename to "patyhto\xyz.txt")
next

I know this isn't the exact code.  I can't seem to work it out where "Param",count would be "param1" and substitued with the filename then move to PARAM2 and a new filename, until it reaches the value in PARAM0.

What am I doing wrong.

Thanks


stanl

Assuming param is a variable

Filename=strcat("param",count)

should be either  Filename=strcat(param,count)   or Filename=strcat("%param%",count)

Secondlaw

Quote from: stanl on January 02, 2018, 11:45:00 AM
Assuming param is a variable

Filename=strcat("param",count)

should be either  Filename=strcat(param,count)   or Filename=strcat("%param%",count)

"param" is not an output variable from parsedata.   The way mine is setup (although it doesn't work), takes this into consideration.  The output from my filename line would be, "PARAM1" then "PARAM2" so on and so fourth.  This portion works but I need to associate "PARAM1", "PARAM2" etc... with the actual Parsedata values which would essentially be file names.

Secondlaw

I think I've figured it out.  I have to use ItemExtract.  :)