imacros javascript不会循环通过csv

时间:2015-08-15 20:56:06

标签: javascript csv syntax imacros

我刚刚用Javascript编写了一个imacros。代码在imacros中运行良好,但是在通过javascript运行时循环不会增加。以下代码继续使用Datasource csv文件的第一行。

macro += "VERSION BUILD=9002379" + "\n";
macro += "TAB T=1" + "\n";
macro += "TAB CLOSEALLOTHERS" + "\n";
macro += "SET !DATASOURCE C:\\imacros\\demo.csv" + "\n";
macro += "" + "\n";
macro += "SET !DATASOURCE_COLUMNS 3" + "\n";
macro += "SET !DATASOURCE_LINE {{!LOOP}}" + "\n";
macro += "URL GOTO={{!COL2}}" + "\n";
macro += "WAIT SECONDS=1" + "\n";
macro += "ADD !EXTRACT {{!COL1}}" + "\n";
macro += "" + "\n";
macro += "TAG POS=1 TYPE=DIV ATTR=CLASS:deguy EXTRACT=TXT" + "\n";
macro += "TAG POS=1 TYPE=DIV ATTR=ID:idvenga EXTRACT=TXT" + "\n";
macro += "SAVEAS TYPE=EXTRACT FOLDER=C:\\imacros FILE=results.csv" + "\n";
var n = 10;

for (i=1;i<=n;i++){
iimPlay(macro);
}

如何让它循环遍历Datasource csv文件的所有行。

1 个答案:

答案 0 :(得分:0)

这是必须控制循环变量

的工作原理
<?php 
try {
  // Use a Stripe PHP library method that may throw an exception....
  \Stripe\Customer::create($args);
} catch (\Stripe\Error\Base $e) {
  // Code to do something with the $e exception object when an error occurs
  echo($e->getMessage());
} catch (Exception $e) {
  // Catch any other non-Stripe exceptions
}