title: Nested loop in iMacros (2nd loop)
body: <p>Hoping you could help me make a nested loop work with iMacros.</p>
  
  <ol>
  <li>First loop: Loops all rows of source.csv (col A, multiple rows)</li>
  <li>Second loop (<strong>X</strong>): Grab all the List elements found on hxxp://site.com/?what={{!COL1}}</li>
  </ol>
  
  <p><em>After a lot of work I feel I am finally getting somewhere:</em> </p>
  
  <p>The problem in the script is that I cannot get Loop <code>{{n}}</code> to grab all the positions of the page (list items).
  Any help would be highly appreciated.</p>
  
  <pre><code>var macro;
  macro =  "CODE:";
  macro +=  "VERSION BUILD=000000" + "\n"; 
  macro +=  "TAB T=1" + "\n"; 
  macro +=  "SET !ERRORIGNORE YES" + "\n"; 
  macro +=  "SET !EXTRACT_TEST_POPUP NO" + "\n"; 
  macro +=  "SET !DATASOURCE source.csv" + "\n";
  macro +=  "SET !DATASOURCE_COLUMNS 1 " + "\n";
  macro +=  "SET !LOOP 1" + "\n"; 
  //macro +=  "SET !TIMEOUT 3" + "\n";
  macro +=  "SET !DATASOURCE_LINE {{i}}" + "\n"; 
  macro +=  "URL GOTO=http://site.com/?what={{!COL1}} " + "\n"; 
  macro +=  "TAG POS={{n}} TYPE=LI ATTR=CLASS:classofdiv" + "\n"; 
  macro +=  "TAG POS={{n}} TYPE=SPAN ATTR=TXT:* EXTRACT=TXT" + "\n"; 
  macro +=  "SAVEAS TYPE=EXTRACT FOLDER=* FILE=All_list_items.txt" + "\n"; 
  
  for (var i=1;i&lt;20;i++)
  {
  iimSet("i",i)
  iimPlay(macro)
  iimSet("n",i)//&lt;-- How to grab all the TAG POS of the website?
  }
  </code></pre>
  
  <p><strong>Edit 1.1</strong> - I should point out that I use the term <code>{{n}}</code> as example to loop list items (div-ul-li-span). If replaced with 'POS=1' the script works, but ofcourse only saves the first list item instead of all the list items. </p>