Reputation: 722
I have a task to extract txt from website to csv file and save info in 1 line, here is my code
Problem seems is because i'm using at the end of extract=txt\n, how i can make it in one line and keep same syntax as i'm using.
for(var i = 1; i <= 6; i++) {
iimPlay("CODE:"
+ 'SET !EXTRACT_TEST_POPUP NO\n'
+ 'TAG POS='+i+' TYPE=DIV ATTR=CLASS:"divtd textcenter vam" EXTRACT=TXT\n'
+ 'SAVEAS TYPE=EXTRACT FOLDER=* FILE=trafficgoals.csv\n'
);
}
Upvotes: 0
Views: 1290
Reputation: 5299
Try in the following way:
var M = "";
for (i = 1; i <= 6; 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';
iimPlayCode(M);
Upvotes: 1