我在这里做的是提取前八项并自动点击下一页。现在我想让它连续提取前八个项目并自动点击下一页并再次提取前八个项目。我尝试为此制作代码,但我没有这样做,它只运行一次并解压缩前八项并自动点击下一页。如何让它连续工作?
var macro1;
macro1 = "CODE:";
macro1 += "SET !LOOP 3" + "\n";
macro1 += "TAG XPATH=.//*[@id='dle-content']/div[1]/div[{{i}}]/div/div[2]/h1/a EXTRACT=TXT" + "\n";
macro1 += "SAVEAS TYPE=EXTRACT FOLDER=c:\ FILE=software.txt" + "\n";
macro2 ="CODE:";
macro2 +="URL GOTO={{link}}"+"\n";
var macro3;
macro3 = "CODE:";
macro3 += "TAG POS=1 TYPE=A ATTR=TXT:Suivant EXTRACT=HREF" + "\n";
for(var i = 1; i < 9; i++)
{
iimDisplay(i); iimSet("i", i);
iimPlay(macro1);
}
iimPlay(macro3)
var link=iimGetLastExtract();
//if there is such a link go to it
if(link!="#EANF#")
{
iimSet("link",link);
iimPlay(macro2)
}
link=iimGetLastExtract();
//if there is not a link like that extract link with text next
if(link=="#EANF#")
{
iimSet("link",link);
iimPlay(macro3)
var next_link=iimGetLastExtract();
//if there is a link with text next navigate to it
if(next_link!="#EANF#")
{
//navigate to link with text
iimSet("link",next_link)
iimPlay(macro2)
}
}
答案 0 :(得分:0)
您可以按如下方式应用无限循环:
// the first part of your code here
while (true) {
for(var i = 1; i < 9; i++)
{
iimDisplay(i); iimSet("i", i);
iimPlay(macro1);
}
iimPlay(macro3)
// the rest of your code
}