Javascript iMacros nested while loop (two loops in macro) -


i have been trying loop inside of loop work. mean i'm going multiple pages in website, clicking links in table , extraction information next page after following link. i've found question here http://www.stackoverflow.com/questions/18402012/nested-loop-in-imacros-2nd-loop, yet can not work me. problem happening @ "while(true)" or "n = 1" section think. code looks this:

const l = "\n";  var macro; macro = "code:"; macro += "set !errorignore yes" + l;  macro += "set !datasource dailycitysummaries.csv" + l; macro += "set !datasource_line {{i}}" + l;  macro += "set !waitpagecomplete yes" + l;  macro += "set !extract_test_popup no" + l;  macro += "url goto=http://{{!col1}}" + l; macro += "frame f=0" + l; macro += "tag pos=1 type=a attr=href:/page/results.cfm?type=location=* extract=txt" + l;  macro += "saveas type=extract folder=/root/desktop/ file=cityname.txt" + l;   var macro1; macro1 = "code:"; macro1 += "tag pos=1 type=a attr=txt:city<sp>{{n}}" + l; macro1 += "tag pos=1 type=strong attr=txt:city<sp>* extract=txt" + l;  macro1 += "tag pos=1 type=table attr=txt:* extract=txt" + l;  macro1 += "saveas type=extract folder=/root/desktop file=citydetails.csv" + l;  (var i=1;i < 19;i++)  { iimset("i", i); iimplay(macro)       //set counter     var n = 1   //this following first link, want of them!     while(true)   //this suppose infinite loop          {         iimset("n", n)         var ret=iimplay(macro1); //kill loop when comes end , go next location (first macro)         if(ret<0)              {             break;             } //increase counter         n++;         } //end of while loop } //end of loop 

is formating or something. code go web page, extract table, click link in overview table, go detail page link, extract table detail page. problem is, it's not clicking links in overview table, first one, , goes through first loop next overview table. number of links different every overview table. know didely javascript, pointers appreciated.

in case wants see code in ended working:

const l = "\n";  var macro; macro = "code:"; macro += "set !errorignore yes" + l;  macro += "set !datasource dailycitysummaries.csv" + l; macro += "set !datasource_line {{i}}" + l;  macro += "set !waitpagecomplete yes" + l;  macro += "set !extract_test_popup no" + l;  macro += "url goto=http://{{!col1}}" + l; macro += "frame f=0" + l; macro += "tag pos=1 type=a attr=href:/page/results.cfm?type=location=* extract=txt" + l;  macro += "saveas type=extract folder=/root/desktop/ file=cityname.txt" + l;   var macro1; macro1 = "code:"; macro1 += "tag pos=1 type=a attr=txt:city<sp>{{n}}" + l; macro1 += "tag pos=1 type=strong attr=txt:city<sp>* extract=txt" + l;  macro1 += "tag pos=1 type=table attr=txt:* extract=txt" + l;  macro1 += "saveas type=extract folder=/root/desktop file=citydetails.csv" + l; macro1 += "back" + l;   // difference made difference  (var i=1;i < 19;i++)  { iimset("i", i); iimplay(macro)       //set counter     var n = 1      while(true)   //this infinite loop          {         iimset("n", n)         var ret=iimplay(macro1); //kill loop when comes end , go next location (first macro)         if(ret<0)              {             break;             } //increase counter         n++;         } //end of while loop } //end of loop 

Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -