我正在尝试一起使用Javascript和iMacros。我每次尝试增量循环4,这就是为什么我使用Javascript
以下是Javascript代码
iimDisplay("Start loop...");
j=4;
k=2;
l=73;
m=72;
n=1;
for (i = 0; i < 10; i++) {
iimSet("firstOne",j);
iimSet("secondOne",k);
iimSet("thirdOne",l);
iimSet("fourthOne",m);
iimSet("fiveOne",n);
retcode = iimPlay("AddCommerceAttributes");
j = j + 4;
k = k + 1;
l = l + 1;
m = m + 1;
n = n + 1;
if (retcode < 0) {
report += ": "+iimGetLastError();
alert ( report );
}
}
iimDisplay("complete");
下面是imacro
VERSION BUILD=7311339
TAB T=1
TAB CLOSEALLOTHERS
URL GOTO=https://example.com/admin/commerce
TAG POS=firstOne TYPE=TD FORM=NAME:bmForm ATTR=CLASS:list-field EXTRACT=TXT
TAG POS=secondOne TYPE=INPUT:RADIO FORM=NAME:bmForm ATTR=VALUE:4 EXTRACT=CHECKED
TAG POS=thirdOne TYPE=INPUT:RADIO FORM=NAME:bmForm ATTR=VALUE:0 EXTRACT=CHECKED
TAG POS=fourthOne TYPE=INPUT:RADIO FORM=NAME:bmForm ATTR=VALUE:2 EXTRACT=CHECKED
TAG POS=fiveOne TYPE=INPUT:RADIO FORM=NAME:bmForm ATTR=VALUE:5 EXTRACT=CHECKED
SAVEAS TYPE=EXTRACT FOLDER=C:\mYFile FILE=ModifyAttributes
我收到此错误
BadParameter: expected POS=<number> or POS=R<number>where <number> is a non-zero integer as parameter 1, line: 18 (Error code: -911)
看起来当我将值从Javascript传递给iMacros时,它转换为String。我需要将其转换回整数吗?如果是的话,怎么做?
提前致谢!!
答案 0 :(得分:0)
您需要将变量放在{{....}}中,以便iMacros知道它是一个变量。这将有效:
更改:
TAG POS = firstOne
为:
TAG POS = {{firstOne}}