Scripting with Python and AutoHotkey

Kevin Wisniewski Problem Solving, Technology Snapshot 5 Comments

After I began programming, I started noticing that some of the things I was doing on my computer at home were repetitive and could be automated to save time and effort. Unfortunately my first language was C++, which doesn’t exactly lend itself well to that kind of work.

I discovered that certain scripting languages could help me fill that need in my day-to-day tasks – Python and AutoHotkey are two languages that I have found helpful. In this blog, I’ll explain why.


When I first discovered Python, I was impressed that it was so easy to use. I adopted it as my go-to tinkering language. In fact, ease of use is one of Python’s design principles. Some universities are even using it to teach entry-level programming courses.

For me, Python was a quick way to get stuff done, like batch renaming files. Sure, I could have learned how to write a Windows batch script to do that, but Python offered more flexibility for other tasks.

One of the great things about Python is its extensibility. It has a lot of built-in functionality and a ton of third-party packages. When I needed to convert a bunch of image files, a quick Google search revealed a Python package with a simple API that did exactly what I needed. I have also used it for text processing with regular expressions, manipulating Excel data, and generating SQL scripts.

Just because Python is easy to use doesn’t mean it’s simplistic. It supports object-oriented, procedural, and even functional programming paradigms (with varying degrees of success). You can do list comprehension, lambda expressions, and a ton of other stuff. I don’t think it’s the best tool for every job. In fact, I’ve never used it in a production environment (though some big names do). For me it’s just another tool in my bag of tricks.

Comic via XKCD –


Around the same time that I started using Python, I discovered AutoHotkey. AutoHotkey is another scripting language. While it can be used for a lot of the same tasks I was doing with Python, where it shines is what it was designed for: writing Windows hotkeys and macros.

AutoHotkey allows you to write all sorts of hotkeys using just about any key on the keyboard. This can go as far as overriding built-in hotkeys in Windows or even only activating a hotkey when a specific program is active. Another thing AutoHotkey does well is manipulate mouse and keyboard input. It has a simple API for simulating user input, which can then be assigned to a hotkey. I’ve used this to automate repetitive website form input so that I didn’t have to bother learning another API.

Both Python and AutoHotkey have excellent documentation and helpful user communities.

Final Thoughts

Something that I love about programming is that every challenge that I encounter typically has multiple ways to go about resolving it. There is always a different tool or language to consider. I’ve found it helpful to use AutoHotkey and Python for some of my day-to-day development needs. Give them a look, and see if they might be helpful in your projects.

— Kevin Wisniewski,

About the Author
Kevin Wisniewski

Kevin Wisniewski

Share this Post

Comments 5

  1. Lou Mauget

    Agreed! Python is superb for easy helper scripting, yet is powerful enough for implementing entire applications. We sometimes use those without realizing they’re Python. I’d stay on 2.x though, not 3.x that seems to be a new language. Then there’s Jython that runs on the JVM. I’ve worked on J2EE applications that had Jython glue inside them. Yup, Python is a cool thing for your toolbox.

    1. Kevin Wisniewski

      Lou, Python 3 did represent a major break for the language. However, Guido van Rossum (the creator of Python) has said that Python 2 development won’t go on past 2.7. Several features from Python 3 have been backported to Python 2. The main reason I use Python 2 is that a lot of the libraries are written for that version. I would prefer 3, but sometimes 2 is more convenient. Van Rossum gave a talk about this very subject, the powerpoint for which is here:

  2. Jay N. Smith

    I am such a Java bigot that I have resisted learning other tools. I have written a LOT of utilities in Java. You have intrigued me, however, and I’ll take a look at AutoHotkey as an appropriate tool for some tasks.

Leave a Reply