title: Javascript + Imacro Random Wait Time Between Steps and Loop Sections Of Code Bug
body: <p>There are some imacro with Javascript questions on here, but nothing that gave me what I need... I tried this question: <a href="https://stackoverflow.com/questions/13801272/imacros-random-wait-time">Imacros: Random wait time?</a> and this question: <a href="https://stackoverflow.com/questions/17959454/how-to-loop-only-a-series-of-steps-in-imacros">How to loop only a series of steps in iMacros</a> (this was helpful, but now what I have is a bit buggy).  I can't figure out why this isn't working...</p>
  
  <p>What I want to do is follow people on Tumblr using imacros.  I added the <code>Math.random()</code> function because I want it to choose a random amount of time within 0 to 11 seconds in which it follows a new person.</p>
  
  <p>I only want the imacro to run this part of the code once because it only needs to be run once:</p>
  
  <pre><code>window.location = "URL GOTO = https://www.tumblr.com/search/pony/recent" + "\n";
  var rand = "Math.random()*7 + 5";  
  var macro = "CODE:SET !REPLAYSPEED FAST" + "\n";
  var macro = "CODE:SET !ERRORIGNORE YES" + "\n";
  macro += "TAG POS={{i}} TYPE=I ATTR=CLASS:icon_view_list&amp;&amp;TXT:" + "\n";
  </code></pre>
  
  <p>Then I want it to loop this part of the code (the actual following steps):</p>
  
  <pre><code>macro += "TAG POS={{i}} TYPE=DIV ATTR=TITLE:Like&amp;&amp;CLASS:post_control&lt;SP&gt;like&amp;&amp;TXT: " + "\n";    
  macro += "WAIT SECONDS={{rand}}";
  </code></pre>
  
  <p>It loops it using this:</p>
  
  <pre><code>for(var i=0;i&lt;100;i++)    
  {
  iimDisplay(i);    
  iimSet("i", i);    
  iimSet("rand", rand);    
  iimPlay(macro);
  }
  </code></pre>
  
  <p>This works well except these lines of code: <code>macro += "TAG POS={{i}} TYPE=I ATTR=CLASS:icon_view_list&amp;&amp;TXT:" + "\n";</code> and <code>var rand = "Math.random()*7 + 5;"</code> do not seem to be working properly.  The first part of code is to make it so it selects the "list view" instead of the "grid view" on tumblr because I cannot get the grid view to work (if anyone has any insight as to why it doesn't work that'd be great, but not a big deal).  The second part of the code isn't working properly because it will always set <code>rand</code> to 11 seconds... so it looks like the <code>Math.random()</code> function isn't working properly and I cannot figure it out.</p>
  
  <p>Here's my entire code:</p>
  
  <pre><code>window.location = "URL GOTO = https://www.tumblr.com/search/pony/recent" + "\n";
  var rand = "Math.random()*7 + 5";  
  var macro = "CODE:SET !REPLAYSPEED FAST" + "\n";
  var macro = "CODE:SET !ERRORIGNORE YES" + "\n";
  macro += "TAG POS={{i}} TYPE=I ATTR=CLASS:icon_view_list&amp;&amp;TXT:" + "\n";
  macro += "TAG POS={{i}} TYPE=DIV ATTR=TITLE:Like&amp;&amp;CLASS:post_control&lt;SP&gt;like&amp;&amp;TXT: " + "\n";    
  macro += "WAIT SECONDS={{rand}}";
  for(var i=0;i&lt;100;i++)    
  {
  iimDisplay(i);    
  iimSet("i", i);    
  iimSet("rand", rand);    
  iimPlay(macro);
  }
  </code></pre>