Batch file: read data from input file

Share your tips, tricks and favorite iMacros macros, scripts and applications for web automation in general here.
Post Reply
rbantau
Posts: 0
Joined: Sat Nov 07, 2009 3:17 am

Batch file: read data from input file

Post by rbantau » Sat Nov 07, 2009 5:38 pm

[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.
Hannes, Tech Support

Re: Batch file: read data from input file

Post by Hannes, Tech Support » Mon Nov 09, 2009 8:08 am

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
Post Reply