AutoIt: Breaking the Monotony

While I don’t think this is exactly what Ralph Waldo Emerson had in mind when he came up with the expression, I think it sums up this post quite nicely. AutoIt is a scripting language that specializes in automating tasks on the computer by basically simulating mouse clicks and keyboard strokes. I picked it up way back in high school in my “script kiddie” days to automate tasks such as renaming my files, spamming forums, filling out questionnaires, and the like. I was young and I like to think I’ve matured somewhat since then. It was actually one of my first programming languages which at the time I didn’t really consider it computer programming, but that’s exactly what I was doing. Over the years I’ve found it useful here and there whenever I find myself doing a repetitive computer task. After programming for a while you tend to start thinking of how to solve problems in loops and try to avoid doing the same thing more than once (at least manually).

Recently I had the need to submit a certain webform 270 times in a nested loop to maximize a certain reward program in as little time and cost to me as possible. When I first saw the deal I immediately started thinking about ways to beat it using a loop. The people who came up with it obviously did not expect for normal people to be able to do something hundreds of times with high efficiency in a short period of time. I won’t delve into the details of the exact program or the calculations, but it involved a decent amount of calculus to get the necessary loop variables. It’s fun to note that the calculations would’ve been greatly simplified had I not wanted to maximize efficiency in both time and cost. Anyway I then set out to write an AutoIt script to save me the hours of monotony filling out forms and waiting for pages to load. This basically consisted of having the script startup Chrome in incognito, navigating to the form, performing the loop actions, and closing the browser. The beauty of AutoIt is you can specify specific windows and control classes via handles to act on ensuring accuracy. On top of that it also gives you full control over window properties to ensure the accuracy of coordinates for mouse actions. I could then instantly enter text wherever I wanted as well as click anywhere without counting tabs to get to other boxes. The coding then was more or less reduced to doing a single manual run of the loop and translating it into the language’s functions. I do wish AutoIt was designed more with web automation in mind as waiting arbitrary constant delay after each page load seems like such a poor solution to me. I realize there are better languages for this job, but AutoIt scripts are incredibly easy to hack together and general to any application. That’s why I love it.

One thought on “AutoIt: Breaking the Monotony”

Leave a Reply

Your email address will not be published.