iMacro JavaScript宏返回-930错误代码

时间:2015-12-01 13:21:28

标签: javascript loops return-value imacros

我正在尝试使用iMacros创建自己的带有2个嵌套循环的宏。 问题是它在第一次尝试时返回-930错误(未找到)。

宏1:循环基页中的链接 宏2:下载到达页面中的所有图像。

我的眼睛很干,看着这个该死的代码好几个小时

// Macro 1 : looping on page links
var macro;

macro =     "VERSION BUILD=8940826 RECORDER=FX " + "\n"; 
macro +=    "TAB T=1 " + "\n"; 
macro +=    "URL GOTO=http://sygap.fr.havasmedia.com/enseigne.aspx?enseig_code=GRDFR " + "\n"; 
macro +=    "TAG POS=1 TYPE=A ATTR=TXT:NIORT " + "\n";  // choix du magasin
macro +=    "TAG POS={{LINKPOS}} TYPE=A ATTR=TXT:LC<SP>4548894 " + "\n";    // boucle (JS) sur les panneaux
macro +=    "TAG POS=1 TYPE=DIV ATTR=ID:Tab2 " + "\n";  // clic sur l'onglet "Photos"


// Macro 2 : downloading images
var macro2;

macro2 =    "ONDOWNLOAD FOLDER=/home/pgori/iMacros/Macros/Recuperation_data_UMT/NIORT/IMG FILE=* WAIT=YES" + "\n"; 
macro2 +=   "TAG POS={{IMGPOS}} TYPE=IMG ATTR=ID:MainContent_ImgAudit1 CONTENT=EVENT:SAVEPICTUREAS" + "\n"; 

// boucle principale sur les liens "LC*" de la page
var link = 1;
while (true) {
    // going to first link
    iimSet("LINKPOS", link)

    // RETURNING -930 ERROR HERE ; WHY ?
    var foundLink = iimPlay(macro);

    if (foundLink < 0) {
        alert("No more links found : " + foundLink);
        break;
    }

    // link found : getting all images on the new page
    var image=1;
    while(true) {
        iimSet("IMGPOS", image)
        alert("Image #" + image);
        var foundImage = iimPlay(macro1);
        if(foundImage < 0) {
            alert("Image break");
            break;
        }

        // to the next image
        image++;
    }

    // to the next link
    link++;
}

0 个答案:

没有答案