How can i set loop iMacros by Javascript?

hcttepe picture hcttepe · Jan 3, 2013 · Viewed 19.5k times · Source

1) I can't add set loop imacros by javascript, How can i add it ?

var macro;
    macro =  "CODE:";
    macro +=  "VERSION BUILD=8011895" + "\n"; 
    macro +=  "TAB T=1" + "\n"; 
    macro +=  "SET !ERRORIGNORE YES" + "\n"; 
    macro +=  "SET !EXTRACT_TEST_POPUP NO" + "\n"; 
    macro +=  "SET !TIMEOUT 3" + "\n"; 
    macro +=  "SET !EXTRACT NULL" + "\n"; 
    //macro +=  "SET !LOOP 1" + "\n"; 
    macro +=  "TAG POS={{loop}} TYPE=A ATTR=CLASS:twitter-timeline-link EXTRACT=TXT" + "\n"; 
    macro +=  "SAVEAS TYPE=EXTRACT FOLDER=* FILE=twitter.csv" + "\n"; 
    var extractedtext=iimGetLastExtract();
    iimPlay(macro);

2) How can i use that code on imacros without javascript ? ( on iim)

var extractedtext=iimGetLastExtract(); 

Answer

Noah picture Noah · Jan 30, 2013

Specify your imacros code as a javscript string and prefix with CODE:

var urls = ['http://google.com', 'http://yahoo.com'];

for (var i in urls) {
  var url = urls[i];
  var returnCode = iimPlay('CODE: URL GOTO='+url);
}