4

我正在尝试:(1) 加载 Firefox (2) 运行 Iopus Imacro (.iim) - 等待此完成,然后 (3) 运行下一个宏。

到目前为止,我已经尝试了 start /wait - call 以及我在互联网上可以找到的尽可能多的其他建议,这就是我到目前为止所拥有的(运行完美 - 只要只有一个宏文件(.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!

当我尝试添加更多文件以运行时,如下所示:

@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 启动,然后一次加载所有 .iim 文件,但没有一个运行。

我还尝试创建多个批处理文件,以便一个运行,然后在第一个完成时调用第二个......没有工作!

此代码从批处理文件中逐个启动宏

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

启动了 2 个 Firefox 窗口,但没有运行任何宏!

@foxdrive - 这是我在@ 9pm 左右的评论中提到的代码......

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

1 回答 1

3

现在宏在完成时删除了这个临时文件,这应该可以工作:

@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
于 2013-08-10T02:22:16.530 回答