/ Development

Automate Everyday Tasks

Programmers sometimes joke how certain jobs could be replaced by a sufficiently advanced Perl script. Now, that is a bit cruel and not entirely true. But office workers typically do have some tasks that are repetitive, consist of copying numbers around, or renaming files — things that probably could be automated.

What I would argue is that us programmers fall to the same traps in our work. When considering automation there are two problems: recognising the things that actually cost us time, and knowing what tasks could be automated in the first place.

Programmers typically have a better grasp of the latter. We know how to hack a simple shell script to rename our files but we sometimes fail at the former: noticing where we waste time and understanding how much time could be saved.

What’s often surprising is how small, routine tasks are actually worth automating. Luckily for every topic there’s a relevant XKCD strip:
Is It Worth the Time?

Given you do a task five times a day and it takes you 30 seconds, you could use three days to fix it and still save time over five years! Small time wastes add up, even if they take just a few seconds at a time.

Automation strategies

So how to decide what to automate? There are two rules: automate things that you actually do repeatedly, and only automate a little bit at a time. Premature optimisation of your workflows does no good either.

It’s easy to go overboard automating tasks when you start. Let’s say you want to create keyboard shortcuts for various commands in your favourite application. No more using that menu bar with a mouse, right? You could spend an hour adding keyboard shortcuts for every command you know, but if you don’t use the newly added shortcuts, chances are you will forget them in a day or two.

A better way is to create shortcuts or automate tasks only when you notice yourself doing them for the third time in a row. Afterwards you should try it a couple times just to build muscle memory.

For larger organisational tasks it’s useful to reserve some time once a week or once a month to look back and think what tasks were done by humans which could have been automated.

Rescue time

To get clues where you might be wasting time, you could run RescueTime. It’s an application that tracks which applications you use and which websites you visit. If nothing else, it will reveal how much you waste time reading Reddit.

Automation examples

To give inspiration on what to automate I gathered some of the tools I use the most. Some of these examples are OS X specific, but similar apps are available for other operating systems. Or you could always code them yourself with Perl.


Grunt is a JS task runner that’s a must for every front-end developer. Task runners work by defining tasks that are then run automatically when files change. Tasks could be for example compiling and minifying styles, running JSHint, minifying JS, running unit tests or starting up a development server. Grunt’s Live Reload option itself will save you a hundred manual page reloads a day. Here’s a good introduction to Grunt.

The category of task runners is growing really fast. One newcomer is Gulp.js which is similar to Grunt with a bit different design goals.


TextExpander is a small Mac utility that watches you type, notices given keywords and replaces those keywords with some other text. A typical example is having multiple email signatures: you could store multiple signatures and assign them three letter shortcuts.

A more useful use for TextExpander is to fix typos. An example: the word “return” is used a lot in programming and apparently I can mistype it at least in six different ways: retirm, retuen, retrun, reutrn, reutnr, retunr. I have setup TextExpander to replaces each of those words with “return“.

Another example: in one project I needed to manually test a web form by filling it out with valid data. One field in the form was bank account number, but honestly, who can remember their bank account number? So for couple days I went to Google, searched for “IBAN“, clicked the link to the Wikipedia IBAN article where I knew I would find a valid bank account number. Copy and paste it to the form and DONE!

I finally realised that I could just create a TextExpander snippet for that number, and now when I type “.iban" TextExpander types “FI37 1590 3000 0007 76”. This use case could be taken further by programming TextExpander to fill out the whole form by moving the cursor between the fields and inserting text to each field.

OS X Automator

OS X comes built in with Automator, an application for creating workflows and running scripts. Automator can launch other applications, capture their output and pass it to other applications.

One use for is to launch different work environments for different projects. For example my each workday starts with running an Automator script that launches three terminals, changes their working directories, runs other scripts, opens a couple websites and an editor, all in a couple of seconds.


This is maybe a micro optimisation I use the most: Alfred is an application launcher that can also launch web searches and handle clipboard operations. Other app launchers for OS X include Quicksilver and LaunchBar.

You specify a key command (like cmd+space) which opens up Alfred’s input field. Type a few letters and Alfred guesses which application or file you want to open. Do this enough times and Alfred learns the applications you use the most. So after a while typing the letter C could become enough to launch Chrome.

Alfred 2 also includes workflows that resemble Automator workflows. There’s a great collection of them here. Some useful workflows include killing processes and opening a path in finder.

Do you have other automation examples? Add a comment!

Learn our ways of working.