title: Change a key function for x amount of time?
body: <p>So thanks to this <a href="https://stackoverflow.com/users/9253414">user</a> i have got this working code, but i want to further tweak it if its posibble. :D</p>
  
  <p><em>Here is the code:</em></p>
  
  <pre><code>global s:=0, c:=0, t:=1500, t2:=380
  
  *lbutton::
      send % Seqkeys("5","6")
      KeyWait, lbutton
      If (A_TickCount-s &lt; t2)
          c := 0
      Send, 7
  return
  
  Seqkeys(params*) { 
      global s, c, t
      max := params.MaxIndex()
      (A_TickCount-s&lt;=t &amp;&amp; (c+=1)&lt;=max) ? c : c:=1
      s := A_TickCount
      return params[c]
  }
  </code></pre>
  
  <p>What i want to implement is that if i hit the right mouse button (Rbutton), the original lbutton seqkeys code changes to this code for 1 second</p>
  
  <pre><code>*lbutton::
      send, 8
      KeyWait, lbutton
      Send, 7
  return
  </code></pre>
  
  <p>than when the 1 sec is over the code is revert back to the original seqkeys state.</p>
  
  <p>I got this code sample but its not working properly for several reasons, when i hit the Rbutton it does override the original Seqkeys function, but it never resets back to the seqkeys one. I put it here maybe it helps</p>
  
  <pre><code>*rbutton::
  toggle:=true
  return
  
  #If Toggle
  *lbutton::
      send, 8
      KeyWait, lbutton
      Send, 7
  return
  toggle:=false
  Return
  #If
  </code></pre>
  
  <p>Thx again! :)</p>