2013-11-14 124 views
2
提交给错误

当我在Firefox中执行该JavaScript .js文件提示错误iMacros的JavaScript的数据保存在Firefox

SyntaxError: wrong format of SET command, line: 1 (Error code: -910) 

在Alexa上这个网址有同样有每个页面25周的结果,并有20个页面,如这个。我需要捕获所有25 x 20 = 500个结果并将它们保存到文件中。

var jsLF="\n"; 

var macro; 
macro = "CODE:"; 
macro += "VERSION BUILD=9002379" + jsLF; 
macro += "TAB T=1" + jsLF; 
macro += "TAB CLOSEALLOTHERS" + jsLF; 
macro += "URL GOTO=http://www.alexa.com/topsites/countries/ID" + jsLF; 
macro += "TAG POS={{i}} TYPE=H2 ATTR=* EXTRACT=TXT" + jsLF; 

var macro1; 
macro1 = "CODE:"; 
macro1 += "VERSION BUILD=9002379" + jsLF; 
macro1 += "TAB T=1" + jsLF; 
macro1 += "TAB CLOSEALLOTHERS" + jsLF; 
macro1 += "URL GOTO=http://www.alexa.com/topsites/countries;{{j}}/ID" + jsLF; 

//loop all the pages for each page get data 
for (var j=0;j<3;j++) 
{ 
iimDisplay(j);  
iimSet("j", j); 
iimPlay(macro1); 
//iimPlay("CODE:SET !EXTRACT {{j}}jsLF SAVEAS TYPE=EXTRACT FOLDER=C:\\ FILE=hiprsites.txt"); 

//loop the first page and get result 
for(var i=0;i<3;i++)  
{ 
iimDisplay(i);  
iimSet("i", i); 
iimPlay(macro); 
iimSet("i",i); 
iimPlay("CODE:SET !EXTRACT {{i}}jsLF SAVEAS TYPE=EXTRACT FOLDER=C:\\ FILE=hiprsites.txt"); 
} 

有人可以帮助我。

回答

2

编辑为您提供的新的要求。我想你想要类似的代码波纹管。仔细查看这些更改,以便能够在未来的宏中复制它们。另外请注意,身份证是印度尼西亚的国家代码,所以在下面的宏中,您将获得该国的500个结果。使用您所在国家需要的代码更改该代码。

var jsLF="\n"; 

var macro; 
macro = "CODE:"; 
macro += "VERSION BUILD=9002379" + jsLF; 
macro += "TAB T=1" + jsLF; 
macro += "TAB CLOSEALLOTHERS" + jsLF; 
macro += "TAG POS={{i}} TYPE=H2 ATTR=* EXTRACT=TXT" + jsLF; 
macro += "SAVEAS TYPE=EXTRACT FOLDER=C:\\ FILE=hiprsites.txt" + jsLF; 

var macro1; 
macro1 = "CODE:"; 
macro1 += "VERSION BUILD=9002379" + jsLF; 
macro1 += "TAB T=1" + jsLF; 
macro1 += "TAB CLOSEALLOTHERS" + jsLF; 
macro1 += "URL GOTO=http://www.alexa.com/topsites/countries;{{j}}/ID" + jsLF; 

//loop all the pages for each page get data 
for (var j=0;j<20;j++) 
{ 
iimDisplay(j);  
iimSet("j", j); 
iimPlay(macro1); 

//loop the current page and get all 25 result 
for(var i=1;i<=25;i++)  
{ 
iimDisplay(i);  
iimSet("i", i); 
iimPlay(macro); 
iimSet("i",i); 
} 
} 

PS:它没有测试,但它应该工作。如果它不让我知道。

+0

感谢您的建议,我会试一试 – computerwizardinc

+0

修改脚本为symbiotech和Bestmacros建议。更新了新的脚本。这一次稍微好一点,但我现在只获得结果值为“0,1,2”节省。它是假设根据需要保存网站的网址。你能否建议在哪里编辑错误 – computerwizardinc

+0

相应的答案。 – symbiotech

1

试试这个

iimSet("i", i);  
iimPlay(macro); 
iimSet("i", i); 
iimPlay("CODE:SET !EXTRACT {{i}}\n SAVEAS TYPE=EXTRACT FOLDER=C:\\ FILE=hiprsites.txt"); 
+0

感谢您的及时回复。我尝试过,但没有运气。仍然有相同的错误。 – computerwizardinc

+0

感谢您的及时回复。我尝试过,但没有运气。仍然有相同的错误。此语句给出错误SyntaxError:SET命令格式错误,第1行(错误代码:-910)iimPlay(“CODE:SET!EXTRACT {{i}} \ n SAVEAS TYPE = EXTRACT FOLDER = C:\\ FILE = hiprsites.txt“);上面的代码 – computerwizardinc

+0

对我的工作很好。 – Bestmacros