title: create a batch file to open firefox, then run a macro (wait for it to finish) then run another macro
body: <p>I am trying to:
  (1) load Firefox
  (2) run Iopus Imacro (.iim) - wait for this to finish, then
  (3) run the next macro.</p>
  
  <p>So far I have tried start /wait - call and as many other suggestions as I could find all over the internet and this is what I have so far (which runs flawlessly - as long as there is only one macro file (.iim) to play):</p>
  
  <pre><code>@ECHO ON
  ECHO
  ECHO You have 5 sec to close this Window to prevent the Macro from running...
  timeout 5
  ECHO Start Firefox and wait another 10 seconds...
  start /B "" "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
  timeout 10
  ECHO Now running the macro (in a 2nd Tab)...
  "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" imacros://run/?m="mymacro1.iim"
  
  rem Macro Execution completed
  ECHO FINISHED!
  </code></pre>
  
  <p>When I try to add more files to run, like this:</p>
  
  <pre><code>@ECHO ON
  ECHO
  ECHO You have 5 sec to close this Window to prevent the Macro from running...
  timeout 5
  ECHO Start Firefox and wait another 10 seconds...
  start /B "" "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
  timeout 10
  ECHO Now running the macro (in a 2nd Tab)...
  "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" imacros://run/?m="mymacro1.iim"
  "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" imacros://run/?m="mymacro2.iim"    
  "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" imacros://run/?m="mymacro3.iim"
  
  rem Macro Execution completed
  ECHO FINISHED!
  </code></pre>
  
  <p>Firefox starts and then loads ALL of the .iim files at once, BUT NONE of them run.</p>
  
  <p>I also tried creating more than one batch file, so that one would run, then call a second one when the 1st one finished ... didn't work! </p>
  
  <p>This code <a href="https://stackoverflow.com/questions/14383576/launch-macros-one-by-one-from-a-batch-file">launch-macros-one-by-one-from-a-batch-file   </a></p>
  
  <pre><code>cd C:\Program Files (x86)\Mozilla Firefox\
  start firefox.exe
  ping -n 05 127.0.0.1&gt;null
  start /wait firefox.exe imacros://run/?m=unlimited1.iim
  start /wait firefox.exe imacros://run/?m=unlimited2.iim
  </code></pre>
  
  <p>Started 2 firefox windows but did not run any macros!  </p>
  
  <p>@foxdrive - here is the code that I mentioned in the comments @ 9pm or so ....</p>
  
  <pre><code>`@ECHO ON
  ECHO
  ECHO You have 5 sec to close this Window to prevent the Macro from running...
  timeout 5
  ECHO Start Firefox and wait another 10 seconds...
  start /B "" "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
  timeout 10
  ECHO Now running the macro (in a 2nd Tab)...
  set "tempfile=C:\Users\Public\Documents\iMacros\Macros\flag.txt"
  type nul&gt;"%tempfile%"    
  "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" "imacros://run/?m="mymacro1.iim"
  :loop1
  if exist "%tempfile%" ping -n 10 localhost &gt;nul &amp; goto :loop1
  
  type nul&gt;"%tempfile%"    
  "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" "imacros://run/?m="mymacro2.iim"   
  :loop2
  if exist "%tempfile%" ping -n 10 localhost &gt;nul &amp; goto :loop2
  
  type nul&gt;"%tempfile%"    
  "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" "imacros://run/?m="mymacro3.iim"
  :loop3
  if exist "%tempfile%" ping -n 10 localhost &gt;nul &amp; goto :loop3
  
  rem Macro Execution completed
  ECHO FINISHED!`  
  </code></pre>