Batch file: read data from input file

Share your tips, tricks and favorite iMacros macros, scripts and applications for web automation in general here.

Moderator: iMacros Moderators

Batch file: read data from input file

by rbantau on Sat Nov 07, 2009 10:38 am

[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.
rbantau
 
Posts: 0
Joined: Fri Nov 06, 2009 8:17 pm

Re: Batch file: read data from input file

by Hannes, Tech Support on Mon Nov 09, 2009 1: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
Hannes, iOpus Support
Hannes, Tech Support
 
Posts: 2120
Joined: Thu Sep 21, 2006 6:27 am


Return to How-To's and useful iMacros: All other topics

Who is online

Users browsing this forum: No registered users and 1 guest

-->