Autohotkey – Record and Repeat Keystrokes and mouse clicks

There are many times when you need to run a test involving repeating certain keystrokes and mouse clicks on an application. This might be for example as part of testing the robustness of a GUI interface that you just created. You essentially want to make sure that repeated use of the buttons and data entering does not lead to any issue.

To achieve this, you would first start doing this test manually. However, doing it manually will not only have time constraints but will also limit the number of iterations of the test that one would do. To address and overcome such problems, Autohotkey is an excellent tool. This windows tool enables you to automate anything from remembering keystrokes, mouse clicks and replaying them to remapping keys and buttons on your mouse/keyboard.

It comes with an in built recorder which you can use to first record your keystrokes and mouse clicks. The actions can then be saved in a script which when run later would replicate the actions recorded earlier. There is an excellent tutorial on their website for learning about the various features of this tool.

The following video shows how autohotkey can be used to achieve the mouse click and keystroke replication.

  1. An excel sheet is made and two cells are highlighted with yellow background where the mouse click and keystrokes would happen. Lets call them cell1 and cell2
  2. AutoScriptWriter which is a recorder that comes installed with Autohotkey is started using <StartMenu-Programs-AutoHotKey>. Once the recorder is started by pressing the red record button on top left, it shows a <Stop> button which can be clicked to stop recording.AutoScriptWriter Autohotkey   Record and Repeat Keystrokes and mouse clicks
  3. Mouse is clicked on cell1 and a value of 1 is entered in it from the keyboard
  4. Mouse is clicked on cell2 and a value of 2 is entered in it from the keyboard
  5. Mouse is clicked on cell1 and a value of 3 is entered in it from the keyboard
  6. Mouse is clicked on cell2 and a value of 4 is entered in it from the keyboard
  7. Stop button is pressed to stop recording. All the actions done are converted in to a script by the recorder.
  8. In this script, the default delay between mouse clicks / keystrokes is generated with a value of 100 which is 100 ms. This is very small for the naked eye to notice and hence is changed to 3000ms or 3s.
  9. The script is saved on the hard disk. On right clicking the script, there is a <Compile Script> option which when clicked will generate an .exe file
  10. This .exe file when executed would repeat all the actions that were recorded and hence would again write the values in the cells of the excel sheet. As you can notice in the video, before running the exe file, the cells of the excel sheet are cleared and now on running this script -- they get populated with the values of 1,2,3,4 as we has specified earlier.

Note the the video does not have an associated audio. So I would request you to go through the description given above once -- before going ahead and viewing the video.

Do share your views on the tool.

Inficone runs on the Genesis Framework

Genesis Framework
Genesis empowers you to quickly and easily build incredible websites with WordPress. Whether you're a novice or advanced developer, Genesis provides the secure and search-engine-optimized foundation that takes WordPress to places you never thought it could go. It's that simple - start using Genesis now!
Follow On Twitter
Follow On Facebook
Follow Using RSS
Follow Using Email
Tweet This Post
Share Post On Facebook
Digg This Post
Add To Delicious
Stumble Upon

Speak Your Mind


Spam Protection by WP-SpamFree