iMacros javascript在Firefox中嵌套循环

时间:2013-05-15 19:09:56

标签: javascript firefox loops nested imacros

我需要在Firefox中运行2个宏。它们都像iim一样完美运行,但我需要让它们一起运行

Macro1:它读取一个文本文件,上面有许多链接,加载链接,然后转到下一个

var macro1 = "CODE:";
macro1 += "VERSION BUILD=8300326 RECORDER=FX" + "\n";
macro1 += "" + "\n";
macro1 += "SET !DATASOURCE C:\\Users\\user1\\Documents\\REPORT_LINK_EXT_OBG.TXT" + "\n";
macro1 += "SET !DATASOURCE_LINE {{!LOOP}}" + "\n";
macro1 += "URL GOTO={{!COL1}}" + "\n";

Macro2:提取macro1打开的每个页面的链接。问题是,在macro1再次移动之前,宏2需要提取1到50个链接。

var macro2 = "CODE:";
macro2 += "VERSION BUILD=7500718 RECORDER=FX" + "\n";
macro2 += "SET !TIMEOUT_TAG 2" + "\n";
macro2 += "SET !LOOP 2" + "\n";
macro2 += "SET !EXTRACT_TEST_POPUP NO" + "\n";
macro2 += "TAG POS={{!LOOP}} TYPE=A ATTR=HREF:*WeldDataLog.aspx?* EXTRACT=HREF" + "\n";
macro2 += "TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:aspnetForm ATTR=ID:ctl00_Main_ucReportHeader_pnlView_txtReportNumber EXTRACT=TXT" + "\n";
macro2 += "'----------------------------------\\/\\/\\/\\/\\/----Change this" + "\n";
macro2 += "SAVEAS TYPE=EXTRACT FOLDER=C:\\Users\\user1\\Documents FILE=LINK_EXT3test.TXT" + "\n";

我基本上需要

待办事项 宏1 做 macro2 环 环

任何人都可以帮助我让这两个宏一起使用而不是互相攻击吗?

1 个答案:

答案 0 :(得分:1)

iimPlay(macro1)

var link1=iimGetLastExtract();

var link2_array=new Array();

for(var i=0; i<50; i++)
{

iimPlay(macro2)
link2_array[i]=iimGetLastExtract();


}

这样的事情对你有用吗?

要检查链接是否已正确提取,您可以使用此

iimPlay(macro)
var link=iimGetLastExtract();

if(link=="EANF")
{

//link is not there

}
else
{

// link is there

}

更改imacros命令的位置。

var macro;

macro ="CODE:";
macro +="TAG POS={{n}} TYPE=A ATTR=HREF:someurl.com EXTRACT=HREF";

for (var i=1;i<=10;i++)
{

iimSet("n",i)
iimPlay(macro)

}