computerwizardinc
computerwizardinc

Reputation: 121

imacros javascript save data to file giving error in firefox

When I execute this javascript .js file in firefox it gives error

SyntaxError: wrong format of SET command, line: 1 (Error code: -910)

This url on alexa there has 25 results per each page and there are 20 pages like this. I need to capture all 25 x 20 = 500 results and save them to file.

var jsLF="\n";

var macro;
macro =  "CODE:";
macro +=  "VERSION BUILD=9002379" + jsLF; 
macro +=  "TAB T=1" + jsLF; 
macro +=  "TAB CLOSEALLOTHERS" + jsLF; 
macro +=  "URL GOTO=http://www.alexa.com/topsites/countries/ID" + jsLF; 
macro +=  "TAG POS={{i}} TYPE=H2 ATTR=* EXTRACT=TXT" + jsLF; 

var macro1;
macro1  =  "CODE:";
macro1 +=  "VERSION BUILD=9002379" + jsLF; 
macro1 +=  "TAB T=1" + jsLF; 
macro1 +=  "TAB CLOSEALLOTHERS" + jsLF; 
macro1 +=  "URL GOTO=http://www.alexa.com/topsites/countries;{{j}}/ID" + jsLF; 

//loop all the pages for each page get data
for (var j=0;j<3;j++)
{
iimDisplay(j);    
iimSet("j", j);
iimPlay(macro1);
//iimPlay("CODE:SET !EXTRACT {{j}}jsLF SAVEAS TYPE=EXTRACT FOLDER=C:\\ FILE=hiprsites.txt");

//loop the first page and get result
for(var i=0;i<3;i++)    
{
iimDisplay(i);    
iimSet("i", i);
iimPlay(macro);
iimSet("i",i);
iimPlay("CODE:SET !EXTRACT {{i}}jsLF SAVEAS TYPE=EXTRACT FOLDER=C:\\   FILE=hiprsites.txt");
}

Can some one help me please.

Upvotes: 2

Views: 2909

Answers (2)

symbiotech
symbiotech

Reputation: 1277

Edit for the new requirements you provided. I think you want something like the code bellow. Take a close look at the changes to be able to replicate them in your future macros. Also mind that ID is the country code for Indonesia, so with the bellow macro you'll get the 500 results for that country. Change that code with the one you need for your country.

var jsLF="\n";

var macro;
macro =  "CODE:";
macro += "VERSION BUILD=9002379" + jsLF; 
macro += "TAB T=1" + jsLF; 
macro += "TAB CLOSEALLOTHERS" + jsLF; 
macro += "TAG POS={{i}} TYPE=H2 ATTR=* EXTRACT=TXT" + jsLF;
macro += "SAVEAS TYPE=EXTRACT FOLDER=C:\\   FILE=hiprsites.txt" + jsLF;

var macro1;
macro1  =  "CODE:";
macro1 +=  "VERSION BUILD=9002379" + jsLF; 
macro1 +=  "TAB T=1" + jsLF; 
macro1 +=  "TAB CLOSEALLOTHERS" + jsLF; 
macro1 +=  "URL GOTO=http://www.alexa.com/topsites/countries;{{j}}/ID" + jsLF; 

//loop all the pages for each page get data
for (var j=0;j<20;j++)
{
iimDisplay(j);    
iimSet("j", j);
iimPlay(macro1);

//loop the current page and get all 25 result
for(var i=1;i<=25;i++)    
{
iimDisplay(i);    
iimSet("i", i);
iimPlay(macro);
iimSet("i",i);
}
}

PS: It is not tested, but it should work. If it doesn't let me know.

Upvotes: 2

Bestmacros
Bestmacros

Reputation: 1867

try this

iimSet("i", i);    
iimPlay(macro);
iimSet("i", i);   
iimPlay("CODE:SET !EXTRACT {{i}}\n SAVEAS TYPE=EXTRACT FOLDER=C:\\ FILE=hiprsites.txt");

Upvotes: 1

Related Questions