title: Autohotkey How to hold a mouse button while a key is pressed?
body: <p>In short:
  How do I write an autohotkey script so that when I press, say, F1, it presses the mouse button down and only lets it go after I let go of the key?</p>
  
  <p>I did some research on both autohotkey forums (which redirect here for asking questions) and read through the documentation, but I'm no programer and have a difficult time grasping loops.</p>
  
  <p>I tried doing while or if(getkeystate("F1") loops but I kept getting it wrong until finally I've ended up with this script, which almost works.</p>
  
  <pre><code>F2::Click down right
  F2 Up::Click up right
  F1::Click down
  F1 Up::Click up
  </code></pre>
  
  <p>When I say almost, I mean it doesn't hold the mouse button down. What I get instead is the mouse clicking insanely fast. It's good enough for most situations like games, where it's basically the equivalent of holding the mouse button, or dragging windows, but when I want to highlight a long paragraph, it doesn't work. After a second or two the whole thing starts blinking or the selection resets, selects in the middle, etc. Basically, it does what would normally happen if you just kept clicking your mouse button really really fast.</p>
  
  <p>This is also the same solution as posted in this question
  <a href="https://stackoverflow.com/questions/14227649/how-to-hold-down-mouse-while-key-is-pressed">How to Hold Down Mouse while Key is Pressed?</a></p>
  
  <p>I initially posted under it a follow-up question, but apparently this is not allowed and it got deleted so I have to create another question with the identical name because I want the same thing.</p>
  
  <p>Please help or shed some light on what I'm doing wrong.</p>