How To Use AutoHotKey To Automate Mouse Clicks And Keystrokes

I’ve covered AutoHotKey before, but didn’t cover how to automate mouse movements until now. In the video below I show how that’s done using an older release of the software (which is still available); I use the older release because it comes bundled with AutoScriptWriter II. That software, while a bit on the ugly side, does make for creating automated mouse scripts a whole lot easier.

Free eBook!

Like what you read?

If so, please join over 28,000 people who receive our exclusive weekly newsletter and computer tips, and get FREE COPIES of 5 eBooks we created, as our gift to you for subscribing. Just enter your name and email below:

Post A Comment Using Facebook

Discuss This Article (Without Facebook)

9 comments

  1. Like the video a lot! A new concept learned thanx a lot. But you use the older version because it is bundled with AutoScriptWriter II.
    Doesn’t the newer version have this feature?

  2. Nice video.I enjoy at the time of watching this video.I like this.You have done a great job by sharing this post with us.I like this pots.Keep sharing with us in future too.

  3. Joe Huard /

    I did this date script back in Nov. 2011 and it still works. I also did two other scripts, one for my signature, and the other as an anti spam warning. Both of them worked for several months, but now they do not. The spam one gives this gibberish;
    2012/01/15 23:37:55 –

    IF YO ufoRWARD THIs E_MALI, PLEASE DELTÆTHE FORWARDIGN HISTORY, INCLUDING MY EMAIl ADRES.

    ERASING THE HISTORY HELPS PREVENT “SPAMMERS” FROM MINING ADDRESESS AN dviRUSE sfrom BEING PROAPGATDE. THANK YOU!

    IF YOU FOWRARD THIS E-MAIL, PLEASE DELETE THE FORWARDIGN HISTORY, INCLUIDNG MY EMAIL ADDRESS>

    ERASING THE HISOTRY HEPLS PREVETN “SPAMERS” FROm miNING ADRESES AND VIURSES FROM BEING PROPAGATED. THAKN YOU!

    IF YOu FORWARD THI se_MAIL, PLEAES DEELTE THE FORWARDIGN HISTOYR, INCLUDING MY EMALI ADRES.s

    ERASIGN THE HISTOYR HELPS PREVENT “SPAMMERS” FROM MINING ADRESES AN dviRUSES FROm BEING PROPAGATED. THANK YOU!

    Do you have any ideas on what I can try to fix this?

    • The script itself might be corrupted slightly.

      My recommendation is to never use Windows Notepad for script editing because it adds in junk that you can’t see that messes up scripts.

      Use Notepad++ instead as it writes “true” proper-written text files for best script execution. It’s a free app available here: http://notepad-plus-plus.org/

      You don’t have to edit any differently than you normally would, just don’t use Windows Notepad when you edit the script.

      • Joe Huard /

        I wrote them in Notepad++. When I open them for editing, they are in Notepad. I just tried to turn off Notepad, but do not know how.

          • Joe Huard /

            Hi Rich,
            I successfully used regedit to change the registry to Notepad++.
            However, I still get junk from the script even after I re-wrote it completely.

            #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.::spm::Send IF YOU FORWARD THIS E-MAIL, PLEASE DELETE THE FORWARDING HISTORY, INCLUDING MY E-MAIL ADDRESS. {Enter} ERASING HISTORY HELPS PREVENT “SPAMMERS” FROM MINING ADDRESSES AND VIRUSES FROM BEING PROPAGATED. THANK YOU{!}ReturnIF YO FORUWRAD HIS E-MAIL HANTK OYU!

          • The immediate thing I notice is that your Send doesn’t have a comma after it. I see “Send IF YOU…” and it should be “Send, IF YOU…”

            There’s also the possibility that AHK is sending out the text too quickly, resulting in garbage characters. You can slow it down by adding in a SetKeyDelay value: http://www.autohotkey.com/docs/commands/SetKeyDelay.htm

            [edit] I should also mention that if the script is executing stuff too fast, you can add in a small pause before certain parts of the script with Sleep http://www.autohotkey.com/docs/commands/Sleep.htm

          • Joe Huard /

            All is well now, Rich. I needed a SetKeyDelay, 30 to get it to print slow enough.

            Thank you.

Leave a Reply

PCMech Insider Cover Images - Subscribe To Get Your Copies!
Learn More
Every week, hundreds of tech enthusiasts, computer owners
and geeks read The Insider, the digital magazine of PCMech.

What’s Your Preference?

Daily Alerts

Each day we send out a quick email to thousands of PCMECH readers to notify them of new posts. This email is just a short, plain email with titles and links to our latest posts. You can unsubscribe from this service at any time.

You can subscribe to it by leaving your email address in the following field and confirming your subscription when you get an email asking you to do so.

Enter your email address for
Daily Updates:

Weekly Newsletter

Running for over 6 years, the PCMECH weekly newsletter helps you keep tabs on the world of tech. Each issue includes news bits, an article, an exclusive rant as well as a download of the week. This newsletter is subscribed to by over 28,000 readers (many who also subscribe to the other option) - come join the community!

To subscribe to this weekly newsletter simply add your email address to the following field and then follow the confirmation prompts. You will be able to unsubscribe at any time.

Enter your email address for
Free Weekly Newsletter: