This story features an app that you could maybe – just maybe – use to automate your entire job.
Probably not, but hey – stranger things have happened. Like that guy who outsourced his entire job to China.
Primarily, though, this is a story of how I channeled my own laziness to create an innovative solution to a problem. Hopefully, it’ll inspire you to do the same.
My friend Zach Sexton (from Asian Efficiency) asked me to write about these episodes of “lazy innovation,” which I told him about while we hung out in Portland; here’s the first one.
I supposed I should start out by saying that there are two types of lazy people in my mind:
- Type-1 lazy people: Those who are too lazy to do tedious work.
- Type-2 lazy people: Those who are too lazy to find ways to avoid said tedious work.
As time has gone on, I have found out more about myself. Specifically, I have found out – beyond a shadow of a doubt – that I am a Type-1 lazy person. Tedious, boring work is the bane of my existence and I will do just about anything to avoid it (including weaseling my way out of required classes).
“Peter Parker. Brilliant but lazy.” – Doc Oc
Type-1 lazy people are likely to be innovators. They’re more apt to put in a few hours of mentally taxing, creative effort to come up with an innovative solution (or at least research one), rather than take the easier route of simply following the script.
Either that, or they’re likely to be voluntarily unemployed. Got stuff to make White Russians, man?
As much as I like White Russians, I also like having the money to make said tasty drinks. So, after my sophomore year, I took Mr. Lebowski’s advice and found a true internship, which happened to be in the IT department at a large financial company.
On one day during the internship, I paused from my normal work to see one of my bosses’ co-workers standing in the entryway to my cubicle. He was staring at my second monitor, probably stewing in a small amount of quiet jealously because the corporate machine had somehow spit up a brand new, widescreen model for me while most of the true employees were still using square, 15″ ones.
Rather than going for my throat, however, he told me:
“I’ve got a special project for you, Thomas. If you’re up for it.”
Of course my chipper, yes-sir intern instincts kicked it. That’s why you hire interns. They’ll do anything with a smile on their face. The Dilbert comic strip where they use Asok, the intern, as a staple remover is funny for a reason.
So you can bet I answered in the affirmative. I’m sure his next thought was, “Wow, he looks so eager. Maybe this project actually won’t break his spirit entirely.”
He went on to tell me that the company had a tool that stores settings for the various servers around the corporate campus. He logged in to this tool, and the screen presented me with a almost eternally-scrolling list of these servers. There were hundreds of them.
The gist of the project turned out to be this:
- I needed to click on each server in the list.
- Once I did that, I’d find the settings panels for that server.
- I was to change several settings – check a few boxes, select something from a dropdown, and type a couple names into some fields.
- Then I had to hit “OK.”
- Once done, repeat – for each of the hundreds of servers.
Oh, and the kicker? The program took about a minute after I’d hit “OK” to process the changes before bringing me back to the main list.
You can see where this is going.
The guy told me, with a sad, pitiful look in his eyes, that this project would likely take me all day to do. Maybe even two days.
Now, I’d like to pause for a moment so you can appreciate my situation here. It was around 8am when I was giving this project. I was looking at a solid 8 hours of doing the same repetitive task over and over and OVER. Click, click, click, type a bit, click, wait. Repeat. Ad infinitum, or so it seemed.
The man left my cubicle, and then the Type-1 laziness kicked in.
“Like hell I’m gonna sit here and do this,” I thought.
What would you do in this situation? Would you grit your teeth, start clicking, and just “do your job”? Or would you defiantly try to find a way out of it?
I was of a mind to take the second option, but since I was a decent enough person not to just up and quit right there, I decided to see if there was a way I could automate this whole process.
You’d think an experienced server tech in the company – someone far more knowledgeable than I – could have just written some uber-complicated shell script that took care of this whole problem on an old glowing terminal machine where no one else would have had to see it.
You’d think that – but since I’d been given the project, I knew this wasn’t the case. I’d have to do it through this infernal GUI, because there was no other way.
Then I had a thought – what if I could do it through the GUI like I was supposed to, except it wouldn’t be me doing it?
During my freshman year, I had played around with an open-source project called Sikuli. Developed by programmers at MIT, Sikuli lets you create programs from a combination of Python syntax and screenshots. That’s right – you can actually write a program based on what your desktop will look like at any given time.
So, all I had to do was figure out what would change on my screen after I completed each step of the process in my horrible, nasty little project.
First, I ran through a few servers just to familiarize myself with everything. Then, I did another server, this time paying very careful attention to every single step of the process – while at the same time thinking about the best way to write a block for doing it in Sikuli.
Luckily, Sikuli is flexible. It’s got a lot of commands, including:
- Click() – by putting a screen shot of a certain region of your desktop in between the parentheses of this function (this makes the screenshot the argument, or parameter, by the way) Sikuli will click it. You can also define the exact coordinates of where to click if the screenshot is big enough.
- Type(“Any Text”) – Sikuli will type the text you specify
- Find() – finds specific objects based on options you define. This is good for finding the right element when there are many on the screen – a particular checkbox, for example
- Wait() – tells Sikuli to wait for a certain period of time before moving on to the next step in the program. This is great for when the screen is still loading (remember that minute-long wait?) but is showing things Sikuli is looking for.
After about an hour of trial and error, my Sikuli script was finally perfect. Then I put on the finishing touches to my solution; I brought up Netflix on my second monitor, started playing Iron Man 2, then hit “Go” on my script.
The computer took over my mouse, and the script started going through the servers, making every change I was supposed to be making. Meanwhile, I was kicking back and enjoying some quality time with Mr. Downey Jr.
Right before it was about time to go home, my script finished changing the setting on the very last server. Because the script simply takes control of your mouse and does things the way you’d normally do them, it didn’t work a whole lot faster than I would have worked myself. It still had to wait for pages to load as well (and I had to program wait times to account for this).
However, my Sikuli script had two big advantages over me:
- It never got bored
- Since it was just doing the same thing over and over, it could keep running over my lunch break
Over the course of that day, I ended up watching several movies on Netflix. It was quite the relaxing day! When the project was finished, I popped over to my co-worker’s cubicle to let him know I’d completed the task.
“Already?” he asked.
“Yep! And, to be honest, I actually just watched Netflix and chilled out all day.”
Note: While it’s fun to brag about this, normally I would have asked for other work. However, the program actually had taken over my mouse, so my computer was unusable. Also, I wasn’t really comfortable with leaving the script unsupervised all day. So Netflix really was the best option.
I then proceeded to tell him how I’d automated the entire process. He was pretty impressed, and asked me to show him Sikuli when I got a chance. Mission accomplished.
Featured Image Credits: High-Octane Villain by JD Hancock, CC by 2.0