我是iMacros中的新手,这是我的第一个宏。任何人都可以帮忙....它得到一个错误宏无法解析
Error -1100: Can not parse macro line: for(i=1,i<11;i++){
这是代码
VERSION BUILD=10022823
TAB T=1
TAB CLOSEALLOTHERS
URL GOTO=http://www.justdial.com/Mumbai/Furniture-Dealers-%3Cnear%3E-jetpur-rajkot/ct-10219686/page-8
SET !EXTRACT_TEST_POPUP NO
for(i=1,i<11;i++){
iimSet("i",i);
var k = 12
k=k+({{i}}*4)
iimPlay(ext);
}
var ext
ext = "CODE:";
ext += "TAG POS={{i}} TYPE=H4 ATTR=CLASS:store-name EXTRACT=TXT";
ext += "TAG POS={{i}} TYPE=P ATTR=CLASS:contact-info EXTRACT=TXT";
ext += "TAG POS={{k}} TYPE=A ATTR=HREF:javascript:void(0); EXTRACT=TXT";
ext += "SAVEAS TYPE=EXTRACT FOLDER=* FILE=Extract_{{!NOW:ddmmyy_hhnnss}}.csv";
答案 0 :(得分:0)
我希望您能通过此代码获得预期的结果。你的代码必须改变几件事。添加并选择在代码运行的初始设置文件名。还修剪了输出字符串中的空白区域。
如果能帮到你,我会很高兴。
iimPlayCode('PROMPT "PLEASE ENTER THE FOLDER NAME FOR OUTPUT FILE" !VAR1'+'\n'+ 'ADD !EXTRACT {{!VAR1}}');
var foldarname = iimGetExtract(1).replace(" ","<SP>");
var trim = 'EVAL("\\\"{{!EXTRACT}}\\\".replace(\\\"#EANF#\\\", \\\"\\\").replace(\\\"more..\\\", \\\"\\\").replace(/^\\\\s*|\\\\s*$/g, \\\"\\\").replace(/\\\\t/g, \\\"\\\").replace(/[\\\\r\\\\n]/g, \\\"\\\");")'+'\n';
trim += 'SET !EXTRACT NULL'+'\n';
var header = "VERSION BUILD=10022823"+'\n';
header += "TAB T=1"+'\n';
header += "SET !TIMEOUT 200"+'\n';
header += "SET !TIMEOUT_STEP 0"+'\n';
header += "TAB CLOSEALLOTHERS"+'\n';
header += "SET !ERRORIGNORE YES"+'\n';
header += "SET !EXTRACT_TEST_POPUP NO"+'\n';
var url = "URL GOTO=http://www.justdial.com/Mumbai/Furniture-Dealers-%3Cnear%3E-jetpur-rajkot/ct-10219686/page-8"+'\n';
var ext = "TAG POS={{i}} TYPE=H4 ATTR=CLASS:store-name EXTRACT=TXT"+'\n';
ext += "SET StoreName "+ trim;
ext += "TAG POS={{i}} TYPE=P ATTR=CLASS:contact-info EXTRACT=TXT"+'\n';
ext += "SET ContactInfo "+ trim;
ext += "TAG POS={{k}} TYPE=A ATTR=HREF:javascript:void(0); EXTRACT=TXT"+'\n';
ext += "SET Address "+ trim;
ext += "ADD !EXTRACT {{StoreName}}"+'\n';
ext += "ADD !EXTRACT {{ContactInfo}}"+'\n';
ext += "ADD !EXTRACT {{Address}}"+'\n';
ext += "SAVEAS TYPE=EXTRACT FOLDER=* FILE={{FOLDER}}.csv"+'\n';
iimPlayCode(header+url)
for(i=1;i<11;i++){
var k = 12
k=k+(i*4)
iimSet("i",i);
iimSet("k",k);
iimSet("FOLDER", foldarname);
iimPlayCode(header+ext);
}
注意:请勿忘记将此代码保存为JavaScript(.js)文件......
答案 1 :(得分:0)
我用javascript.js尝试了这个代码,但它给了我一个错误。
这是代码
iimPlayCode('PROMPT "C:\Users\lalit patel\Documents\iMacros\Downloads\" !VAR1'+'\n'+ 'ADD !EXTRACT {{!VAR1}}');
var foldarname = iimGetExtract(1).replace(" ","<SP>");
var trim = 'EVAL("\\\"{{!EXTRACT}}\\\".replace(\\\"#EANF#\\\", \\\"\\\").replace(\\\"more..\\\", \\\"\\\").replace(/^\\\\s*|\\\\s*$/g, \\\"\\\").replace(/\\\\t/g, \\\"\\\").replace(/[\\\\r\\\\n]/g, \\\"\\\");")'+'\n';
trim += 'SET !EXTRACT NULL'+'\n';
var header = "VERSION BUILD=10022823"+'\n';
header += "TAB T=1"+'\n';
header += "SET !TIMEOUT 200"+'\n';
header += "SET !TIMEOUT_STEP 0"+'\n';
header += "TAB CLOSEALLOTHERS"+'\n';
header += "SET !ERRORIGNORE YES"+'\n';
header += "SET !EXTRACT_TEST_POPUP NO"+'\n';
var url = "URL GOTO=http://www.justdial.com/Mumbai/Furniture-Dealers-%3Cnear%3E-jetpur-rajkot/ct-10219686/page-8"+'\n';
var ext = "TAG POS={{i}} TYPE=H4 ATTR=CLASS:store-name EXTRACT=TXT"+'\n';
ext += "SET StoreName "+ trim;
ext += "TAG POS={{i}} TYPE=P ATTR=CLASS:contact-info EXTRACT=TXT"+'\n';
ext += "SET ContactInfo "+ trim;
ext += "TAG POS={{k}} TYPE=A ATTR=HREF:javascript:void(0); EXTRACT=TXT"+'\n';
ext += "SET Address "+ trim;
ext += "ADD !EXTRACT {{StoreName}}"+'\n';
ext += "ADD !EXTRACT {{ContactInfo}}"+'\n';
ext += "ADD !EXTRACT {{Address}}"+'\n';
ext += "SAVEAS TYPE=EXTRACT FOLDER=* FILE={{FOLDER}}.csv"+'\n';
iimPlayCode(header+url)
for(i=1;i<11;i++){
var k = 12
k=k+(i*4)
iimSet("i",i);
iimSet("k",k);
iimSet("FOLDER", foldarname);
iimPlayCode(header+ext);
}
错误-1100:无法解析宏行:iimPlayCode('PROMPT“C:\ Users \ lalit patel \ Documents \ iMacros \ Downloads \”!VAR1'+'\ n'+'ADD!EXTRACT {{!VAR1 }}“);