Wait until firefox has finished

I am running a macro script from the command line. But the script doesn't wait until the task has finished.

firefox imacros://run/?m=macro_script.iim
firefox imacros://run/?m=macro_script2.iim

How do I get it to wait until the macro has been completed?

I am using imacros, a firefox addon.

Why not have your imacros script call the other imacros script itself? Very little except your web script is going to know when your web script finishes...