Launch macros one by one from a batch file

2019-04-11 12:25发布

问题:

In Firefox, Using Imacros, I would like to launch multiple macros from a batch file but here is the problem: I want them to run one by one.
So first 'Macro 1' will run then after it completes, 'Macro 2' will run and so on till 'Macro 7'.

My BATCH CODE:

cd C:\Program Files\Mozilla Firefox
start firefox.exe 
ping -n 05 127.0.0.1>nul
start firefox.exe imacros://run/?m=NAMEofMACRO.iim

Imacros VERSION BUILD=7601105

回答1:

Just change your macro line to use the start switch /wait

start /wait firefox.exe imacros://run/?m=NAMEofMACRO.iim
start /wait firefox.exe imacros://run/?m=NAMEofNextMACRO.iim
start /wait firefox.exe imacros://run/?m=NAMEofNextMACRO.iim

That will launch each one, wait for it to finish, then start the next.



回答2:

Another way, inside imacros, is to add at the and of each macro.iim the line

URL GOTO=imacros://run/?m=NAMEofNextMACRO.iim

So you have to run just the first macro; this macro, at the end will call the second, and the second, at the end, will call the third, and so on...