How to Automate Mundane Tasks with AutoIt

autoit logo   How to Automate Mundane Tasks with AutoItAutoIt allows you to perform a series of actions and saves a snapshot of the actions. It’s called a macro in geek-speak. Then by simply invoking that macro, the same series of actions is taken again, identical to the first time you did it. Yet, this time all you did was click one icon. If Homer J. Simpson’s math holds true, that takes a 42-step process, reduces it to one, thus increasing productivity by 42-fold. Is that worthy of a raise?

Here’s how I used AutoIt to create a macro to run CCleaner on my laptop. Yes, something this simple could be done with Windows Scheduler, yet this is a fun entry point to creating far more complex macro scripts.

Step One: Download and Install AutoIt and AutoIt Script Editor

Just jump over to AutoIt, download the appropriate install file and begin the install. I’d recommend going for the Full Installation. It’s only 8 MB in size, so it downloads fairly quick. While you are there you will need to download the AutoIt Script Editor, as well.

Once the download is complete you can begin the process of installing it. Here’s what that will end up looking like:

install step 11   How to Automate Mundane Tasks with AutoIt

Standard start install screen. Go ahead and click next.

install step 21   How to Automate Mundane Tasks with AutoIt

Standard EULA. Give props to Jonathan Bennett and the AutoIt Team for this fine software. Click I Agree.

install step 31   How to Automate Mundane Tasks with AutoIt

For now, you want to choose Run the script as the option. If you are already familiar with scripting, go ahead and check Edit the script. Either way, once your choice is made, click Next.

install step 51   How to Automate Mundane Tasks with AutoIt

Choose where you want to install the program. C:\Program Files\AutoIt3 is the default location. Works for me! Click Install.

install step 61   How to Automate Mundane Tasks with AutoIt

There it goes! Installing away…

install step 71   How to Automate Mundane Tasks with AutoIt

It says that the release notes are very important. In my opinion, they are only important if you’ve been using AutoIt for awhile and you are not new to scripting in Windows. Other than that – not that important. Click Finish.

Step 2:  Installing AutoIT Script Editor

Yes, this seems like a lot of work to avoid a little work. Please stay with me on this. I’m going to show you how to do just one thing with AutoIt, but once you get into it, there’s no end to what you can automate with it. Hang in there.

Find the installer on your desktop and double-click on it.

install scite 1   How to Automate Mundane Tasks with AutoItStandard start an install screen. Moving on.

install scite 2   How to Automate Mundane Tasks with AutoItYep, looks about right. Let’s click Next.

install scite 3   How to Automate Mundane Tasks with AutoItEULA, blah, blah, blah. I mean, read it carefully and cherish the amazing copywriting. Click I Agree, if you agree.

install scite 4   How to Automate Mundane Tasks with AutoItIT’S INSTALLING! IT’S INSTALLING!!!!!!!! Cameraman, are you getting this?

install scite 5   How to Automate Mundane Tasks with AutoIt

Click Finish. Take note of the Use Ctrl+F1 to get help on getting started. Annnnnnnnnd, we’re done.

Whew. Let’s get down to making a macro shall we?

Step 3: Macro Making

The trick here is to open the right program in that bunch of stuff that we just downloaded and installed. Click on Windows Start > AutoIt> SciTE> SciTE. Just like in the picture:

start scite   How to Automate Mundane Tasks with AutoIt

Now, the appropriate SciTe editor will be open. Just to make your life easier, and believe me that’s what I’m trying to do, you may want to create a shortcut to this on your desktop.

Once the SciTe editor is open, you may want to close other programs and focus on this process. Multiple windows just makes things confusing.

initiate recorder   How to Automate Mundane Tasks with AutoIt

Once SciTE is open, click on Tools > AU3Recorder. This will open up AU3Record 3.1.

au3record step 1   How to Automate Mundane Tasks with AutoIt

What I’m going to do is run CCleaner. Make sure to check Record Window Text and Record Mouse. Click on Browse and navigate to the ccleaner.exe file.

select exe for autoit   How to Automate Mundane Tasks with AutoIt

Double-click on it to select it. You’ll see the path shown in the Run(‘ ‘) text field.

click to record 2   How to Automate Mundane Tasks with AutoIt

Now you can Click to Record the tasks you want to automate.

ccleaner   How to Automate Mundane Tasks with AutoIt

CCleaner will open. That’s good. Now, click on Run Cleaner and wait for it to do it’s job. Then, close CCleaner.

click to stop   How to Automate Mundane Tasks with AutoIt

Go back to the AU3Record window and click on Click to Stop. There! You’ve recorded your macro. Click on File > Save As and save the macro with a good name like quick_clean.au3.

quick clean au3   How to Automate Mundane Tasks with AutoIt

Now when you want to run CCleaner, all you have to do is double click on quick_clean.au3.

Not too bad! Think of this as your “Hello World” program for AutoIt.

By doing this, you’ve just delved into the the world of Window’s Scripting. Keep going. Think of those things that are repetitive that you have to do with your computer and make the macro to suit. I used AutoIt to make an installer for LogMeIn Free that I could send to my field users. All they had to do was double-click the installer and away it went! They didn’t need to know my LogMeIn password or anything else.

You can also create an executable and obfuscate the code so it is harder for people to reverse engineer. You really want to do that if there are passwords involved.

I hope you found this tutorial useful and that you may find a place for AutoIt in your toolbox. It really is a very powerful suite of software and the price is right. Here’s the download link again. AutoIt will only work on Windows.

How do you take care of complex repetitive tasks? Let us know in the comments.

The comments were closed because the article is more than 180 days old.

If you have any questions related to what's mentioned in the article or need help with any computer issue, ask it on MakeUseOf Answers—We and our community will be more than happy to help.

9 Comments -

Mel

As anyone who claims to be a geek (at heart at least) know the AHK (Auto Hot Key) as the defacto standard of windows macro building, editing and running. I had dabbled with creating a .ahk script and running it. Was not very impressed by the results. I was wondering if anyone actually installed and used it for something meaningful, like entering the same text into a form with 37 required fields ?

Rarst

I don’t think there is such a thing as defacto standard for macro. Too many solutions that cater to different people.

Personally I do not macro (as in record and play) much but AutoIt is my language of choice for small utilities.

Doc

I’ve used AutoHotKey to convert my ABit Media XP Pro Remote’s into something useful…aside from the 4 “arrow” keys and the Select (Enter) key (which emulate a normal keyboard), they keys produce CTRL+ALT+SHIFT+function key keystrokes, which AHK converts into whatever I want; the sample volume key script adds an on-screen volume control (which also captures my Logitech keyboard’s volume/mute keys, plus WIN+cursor up/down). A few more tweaks adds ALT+ENTER (full screen), ALT+TAB, Windows Start button, ALT+F4, “My Computer” buttons, which makes browsing my media library and playing videos MUCH easier from my couch!

Go to http://www.donationcoder.com for dozens of other AHK scripts (many compiled into EXE form) that are QUITE useful!

Shon

I have used AHK many times. I have used it for creating login routines for ldap servers as well as for just menial tasks.

You may want to have a look at donationcoder.com They are a very helpful community and will even write scripts for you if you post it in the request section.

ShakiestNerd

I’ve used both AutoIt and AutoHotkey and they are both good. Their scripts are basically compatible with each other.

Started out using it for launching apps with a hotkey, e.g. ctrl+alt+f launches firefox.

It can also be used to be used as a global auto-correct for things you frequently misspell. Same feature can also be used to auto-expand text in chat windows. For example, if you type “btw” it can automatically expand out to “By the way,”.

A similar use is to add signatures to emails or a pithy quote to blog comments.

Also use it to automatically fill in forms on web pages. Have one that will scrape an excel file and paste the data in a form I have to fill out.

Scripts can be compiled into .exe as mentioned. A friend of mine has written a couple utilities that he has compiled so that he can distribute them to non-AutoIt users. One really good one has a GUI front end and pulls user lists and groups from active directory.

Good tool!

ajbritton

I cannot speak for AHK, but AutoIt is one of the finest utilities out there. I’ve used it to create all kinds of small administration utilities which I use in a medium sized network. Simple GUIs are easy to create with a bit of practice and it’s even possible to create little apps that live in the system tray. I love it.

erik

AHK is my choice. It is pure genius. Automizing my daily jumping between 4-5 programs in Windows. An extreme shortcut compared to developing something in VBA.