title: iMacros + Javascript - How to refresh on page timeout?
body: <p>I searched throughout but was unable to find a solution to this issue.</p>
  
  <p>I have an iMacros .js that goes through a .CSV file with the following structure (URL, Value) and:
  1. Visits the URL.
  2. Inputs the specific value into a field.</p>
  
  <p>Rinse. Repeat.</p>
  
  <p>However, even with TIMEOUT value set to max, there are still occasions where the page will fail to load. I could set ERRORIGNORE to YES but then I would miss out on several pages on the list and I wouldn't know about it.</p>
  
  <p>As such, what I am searching for is for code that will let me run my macro, and in case the page times out, refreshes it and runs the macro again without skipping a line in the CSV.</p>
  
  <p>Here's how my .js looks:</p>
  
  <pre><code>for (i = 1; i &lt;= count_of_lines; i++) { //The amount of times the Macro will loop should be defined here.
  iimSet("i", i) //Set "i" so it is able to extract the nest row from the .csv file
  
  var Macro;
  
  Insert_Rating = "CODE:" //Need to use code here so that iMacros knows that the code will start
  Macro += "TAB T=1" + "\n";
  Macro += "CMDLINE !DATASOURCE FILENAME.csv" + "\n";
  Macro += "SET !DATASOURCE_LINE {{i}}" + "\n";
  Macro += "SET !TIMEOUT_PAGE 120" + "\n";
  Macro += "URL GOTO=URL{{!COL1}}" + "\n";
  Macro += "WAIT SECONDS=1" + "\n";
  Macro += "TAG POS={{!COL2}} TYPE=A ATTR=TXT:" + "\n";
  
  }
  iimPlay(Macro); 
  </code></pre>
  
  <p>I also tried with </p>
  
  <pre><code>var ret = iimPlay(Macro)
  if (ret&lt;0) {
  iimPlay("CODE:REFRESH");
  } else {
  iimPlay(Macro);
  }
  </code></pre>
  
  <p>But what happens here is that the code will check once (at the start of the if) and then attempt to run through the entire CSV if the initial condition is true.</p>
  
  <p>I would need a way to check at each line of the CSV if the page timed out.</p>
  
  <p>Perhaps this has a simple solution, but my coding skills are extremely basic.</p>
  
  <p>Thank you in advance for all your help.</p>