Loop the value of variable in batch from .txt

April 6, 2011 at 03:35:16
Specs: Windows 7 Home edition
Hello. I'm trying to run a program using iMacros in batch. basically the program will take two screenshots of every page we have, with 4 hours interval per screenshot. We have 42 pages that need to run once a week so I decided to run 6 pages a day within 24 hours. The URL of 42 pages are the same except for their parameter.

Now I want to supply the parameter to a single batch file using .txt file. Is that possible? This is actually what's in the .bat

"C:\Program Files (x86)\iOpus\iMacros\iMacros.exe" -macro "screenshot.iim" -var_variable url1

basically it calls the imacros program and run my recording and supply the url1

but I have url1-url42. How will I instruct the bat to get the value - url1 to url4 with 4 hours interval? Is there another way to do this? the program is required to be in .bat. Any help from you guys will be very much appreciated. Thanks in advance.

note that url1 - url42 are different parameters and it's just an example.

See More: Loop the value of variable in batch from .txt

Report •

April 6, 2011 at 05:05:16
If I'm with you:

:: ==========================================
:: lizac2.bat Wed 06-04-2011 19:01:16.53
@echo off & setLocal enableDELAYedeXpansioN

for /L %%a in (1 1 14) do (
echo iMacros.exe -macro "screenshot.iim" -var_variable url%%a

Life is too important to be taken seriously.


Report •

April 6, 2011 at 05:18:22
Hello Mechanix2Go. First thanks for your help but I think I confused you with the variable. I'm not using exactly the url1-url42.

I got some code here:

for /f "tokens=* delims= " %%G in (urls.txt) do "C:\Program Files (x86)\iOpus\iMacros\iMacros.exe" -macro "screenshot.iim" -var_variable %%G

here's the exact content of urls.txt

My problem with this code is that it doesn't stop until it reaches the end of file. There's another command that needs to be executed for each variable filled in. That command will have an interval of 4 hours.


for the first run, I will have the page "mypartner", execute the next command (will have 4 hours delayed), then go to the next variable which is "offercode" and so on...

Thank you again.

Report •

April 6, 2011 at 05:47:45
by the way, just to add more. I will need the output of this command before the next command is executed. Thanks!

Report •

Related Solutions

Ask Question