Pages

Tuesday, July 2, 2013

Save your fingers (and your job!) with this mouse emulator Autohotkey script


I found a great mouse emulator script for the popular Open Source program, Autohotkey. I use this script with Autohotkey to relieve the stress of mouse clicks on my right index finger. Now I can press F1 for a mouse click and F2 for a right click. If I hold the F1 key down, it simulates a left-mouse-click-and-hold. Right now, I find it indispensable.

It's not easy to find an Autohotkey script that does this. If you do, please let me know. I spent at least 2 hours looking for a simple script that could do this. All thanks to the forum member "deletemeafteraweek" for posting this, whoever he or she is.



This script and Autohotkey ought to reduce the wear and tear on my fingers due to excessive work on the PC and mousey. I find it joy to use. My right index finger says a big "THANK YOU!" to the F1 and F2 key now.


From http://www.autohotkey.com/board/topic/94280-simple-keyboard-mouse-click-script/?hl=mouse

 deletemeafteraweek

  • Members
  • 1 posts
    I could not find my answer anywhere and after a few hours of reading through lots and lots of obscure documentation, trying while() and if() loops I have created this simplest of scripts. Too bad it's not documented nowhere obvious that you can do keypress macros and keyrelease macros by simply putting "Key::Function" and "Key up::Function"
     
    Here's my script. It maps F1 to left mouse button and F2 to right mouse button. Hold the key to drag stuff. Press it to click. Great for people like me who got a comfortable logitech mouse with a broken key and are too cheap to buy a new replacement.
    ; Recommended for performance
    #NoEnv
    
    ; Better and more reliable
    SendMode Input
    
    ; Press the right mouse button unless it's already pressed.
    F2::
     if ( not GetKeyState("RButton" , "P") )
      Click down right
    return
    
    ; Release the mouse button when the key is released.
    F2 Up::Click up right
    
    F1::
     if ( not GetKeyState("LButton" , "P") )
      Click down
    return
    
    F1 Up::Click up

    If you like this post or site
    a small donation would be nice but would last only a day,
    otherwise leaving a comment (or a compliment) below will last me a month!

    Ratings and Recommendations by outbrain