08-14-2005 10:29
OK. There's this thing we have to do at the office once a month that is pure-D monkey work. Strictly a routine series of steps, not a single decision in sight. Go down a list of values, using it to color parts of a map in Adobe Illustrator CS, one by one. Rinse and repeat twice for a total of three maps. Print the maps out and exchange them for proofreading. Correct the inevitable clerical error or two. Ship off for printing.

We've got a ton of emergency stuff to do tomorrow, and tomorrow is Map Day. It takes us about four manhours between us to plod through this little drill. That's been sticking in my craw for as long as I've had a part of this task, and having finally scored my own key for weekend access, I'm going to go in today and see if I can get this automated.

This means I will have to use AppleScript.

AppleScript, people.

Take all of the worst features of Smalltalk, Visual Basic and crystal meth, and you've got AppleScript.

I picked up a copy of some Definitive Guide or other from the local library, and the author, who is apparently a world-class guru, spends the first chapter talking about what a nightmare AppleScript is to work with.

The good news is, I can do most of the gruntwork in Ruby. So, the current plan is to have Ruby parse the data file, match up the region names and status to a hashtable of Illustrator objects which I will have created by walking through the map and hand-querying each region in interactive AppleScript, and then write a well-formed AppleScript file and shell out to execute it via osascript.

In other words, it's going to take me about 90 minutes to get 80% of this work done. Then, I can spend the rest of the day figuring out what the Hell I have to say to the AppleScript interpreter to get it to do the 20% of the job that only AppleScript can do.

LSL, flawed? LSL is a dream language. APL is a dream language. COBOL is a dream language. OOK is a dream language.

Please be thankful for your blessings in my absence.

-- jj