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.
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.
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, [email protected]