javascript - How to go to new line after each 6 iterations in Imacros -
i'm extracting data website. in 1 line in csv goes 6 parameters separated commas, need go new line , on. when macros increased loop 6 need go new line in csv line.
i tried this
if(i % 6 === 0)
but it's not working.
var id = window.document.getelementsbyclassname('divtd textcenter vam').length; var m = "", a=0, b='\\n'; (var = 1; <= id; i++) m += 'tag pos='+i+' type=div attr=class:"divtd textcenter vam" extract=txt\n'; m += 'set !extract eval("\'{{!extract}}\'.replace(/\\\\n/g, \'\');")\n'; m += 'saveas type=extract folder=* file=trafficgoals.csv\n'; if(i % 6 === 0) { iimplaycode('set !extract '+b+'\nsaveas type=extract folder=* file=trafficgoals.csv'); } iimplaycode(m);
maybe need solution:
var id = window.document.getelementsbyclassname('divtd textcenter vam').length; (j = 1; j <= math.ceil(id / 6); j++) { var m = ""; (i = 1 + 6 * (j - 1); <= math.min(6 * j, id); i++) m += 'tag pos=' + + ' type=div attr=class:"divtd textcenter vam" extract=txt\n'; m += 'set !extract eval("\'{{!extract}}\'.replace(/\\\\n/g, \'\');")\n'; m += 'saveas type=extract folder=* file=trafficgoals.csv\n'; iimplaycode(m); }
Comments
Post a Comment