Sunday, November 19, 2006

Automation - continued

It has been roughly a month since I started voluntarily pushing the limits of automation in my life. This has been mixed blessing.

  • medium to long -term quality of life is improved
  • helps me assimilate Ruby libraries
    (spending a lot of time on

  • spending a fair amount of time automating
  • still facing the initial resistance to automation

A Story: Mac OS X Screenshots

3 words: CMD-SHIFT-4

One of the joys of working with Mac OS X is the screenshot mechanism part of the OS. Nothing to install, it is expected that you would want to take screenshots easily. You type CMD-SHIFT-4, you get a crosshair, you select a region, then a file is created on your desktop. Painless.

CMD-SHIFT-4 takes care of the file creation, a mental block in process of saving a screenshot. In the spirit of Don't Make Me Think, I can testify that one question I don't want to answer when taking a screenshot is "what filename should I save this as...?" Imagine taking a picture with a camera and being asked to give it a filename... I just want to save the screenshot, I will come back to it later. In fact, I just want a long list of screenshots I take to be dumped somewhere, as a chronological series of things I found interesting.

Mac OS X already takes care of incrementing the filename automatically. Image 1.png, Image 2.png, etc... That's great. However, I was not so hot about the default "dumping" location. So, naively, I created a folder called "dump" to which I would push the pictures when cleaning up. What I had not fully absorbed was that I would have a filename conflict on my hands every time I did that. If I had dumped a few screenshots to "dump", took a few more, and tried to push my files to "dump" again, chances would be very good I would have, for example, 2 files named "Image 1.png", the second one wanting to overwrite the first.

Before I had become such a stickler for automation, I had decided to zip the pictures, name the file based on the date and push it to "dump". This involved the manual steps of, selecting only the pictures on the desktop, selecting the "archive" option from the menu, finding out what was today's date, renaming the file in ISO style date format and moving the file to "dump".

Today, while contemplating the mess that my desktop was becoming, I realized how badly in need of automation this process was. So, 15 minutes of hacking later, I had a script that would select the pictures on the desktop (only the ones matching the screenshot naming convention), find out how many pictures I had moved so far (stored in a magic file in the destination directory), move the files while changing their names incrementally. A little more work was involved in figuring out how to have automator run this script as a plugin.

Now, I have what I wanted: screenshots stream.


Post a Comment

Links to this post:

Create a Link

<< Home