Create a batch file to open firefox, then run the macro (wait for it to finish), then run another macro

I'm trying to: (1) download Firefox (2) run Iopus Imacro (.iim) - wait until this is over, then (3) run the following macro.

So far I have tried starting / waiting for a call and many other suggestions that I could find all over the Internet, and this is what I still have (which works flawlessly - so far there is only one macro file (. Iim):

@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! 

When I try to add more files to run, for example:

 @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! 

Firefox starts and then downloads ALL .iim files at a time, BUT NONE of them start.

I also tried to create more than one batch file so that it could be run, and then call the second when the first finished ... does not work!

This one-on-one-of-one-out-of-one-package-batch code

 cd C:\Program Files (x86)\Mozilla Firefox\ start firefox.exe ping -n 05 127.0.0.1>null start /wait firefox.exe imacros://run/?m=unlimited1.iim start /wait firefox.exe imacros://run/?m=unlimited2.iim 

They launched 2 firefox windows, but did not run any macros!

@foxdrive - here is the code I mentioned in the comments @ 9pm or so ....

 `@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>"%tempfile%" "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" "imacros://run/?m="mymacro1.iim" :loop1 if exist "%tempfile%" ping -n 10 localhost >nul & goto :loop1 type nul>"%tempfile%" "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" "imacros://run/?m="mymacro2.iim" :loop2 if exist "%tempfile%" ping -n 10 localhost >nul & goto :loop2 type nul>"%tempfile%" "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" "imacros://run/?m="mymacro3.iim" :loop3 if exist "%tempfile%" ping -n 10 localhost >nul & goto :loop3 rem Macro Execution completed ECHO FINISHED!` 
+4
source share
1 answer

Now that the macros delete this temporary file when they end, this should work:

 @echo off 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 set "tempfile=C:\Users\Public\Documents\iMacros\Macros\flag.txt" echo macro 1 running type nul>"%tempfile%" start "" /w /b "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" imacros://run/?m="mymacro1.iim" :loop1 if exist "%tempfile%" ping -n 10 localhost >nul & goto :loop1 echo macro 2 running type nul>"%tempfile%" start "" /w /b "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" imacros://run/?m="mymacro2.iim" :loop2 if exist "%tempfile%" ping -n 10 localhost >nul & goto :loop2 echo macro 3 running type nul>"%tempfile%" start "" /w /b C:\Program Files (x86)\Mozilla Firefox\firefox.exe" imacros://run/?m="mymacro3.iim" :loop3 if exist "%tempfile%" ping -n 10 localhost >nul & goto :loop3 
+3
source

Source: https://habr.com/ru/post/1496258/


All Articles