Page 1 of 1

Batch file: read data from input file

Posted: Sat Nov 07, 2009 5:38 pm
by rbantau
[quote="Hannes, iOpus"]The following batch file reads an input file line by line and uses the file's data in an imacros command line invocation

[code]
@echo off
for /f %%A in (input.txt) DO (
imacros.exe -macro "#Current" -loop %%A
)[/code][/quote]

So when it reads the line of data, what var is it passed to? How would you use the data in imacros? Specifically, I want to read a file that is a list of URLs and then I want to pass that to URL GOTO=!VAR1 or whatever I need to do. Also, would I run that batch file itself or would imacros run that piece of code? I'm still learning. Thanks for your help.

Re: Batch file: read data from input file

Posted: Mon Nov 09, 2009 8:08 am
by Hannes, Tech Support
rbantau wrote: So when it reads the line of data, what var is it passed to? How would you use the data in imacros? Specifically, I want to read a file that is a list of URLs and then I want to pass that to URL GOTO=!VAR1 or whatever I need to do. Also, would I run that batch file itself or would imacros run that piece of code?
We do not recommend performing the loop on the command line. For complex loops, use the Scripting Interface . For simple ones, i.e. repeating the full macro several times, use the "Play (loop)" button.

For entering data from a CSV file, use the DATASOURCE commands, cf. CSV input