Fetching blog updates from Weblogs.com using Applescript

As I mentioned earlier this week, I’m running an AppleScript once an hour to download data from Weblogs.com. For anyone who may be interested in seeing how it’s done, the code is below and is easily adaptable to other scripting languages, including DOS Batch (I know, I’ve done it). This is first pass code, not optimized, warts and all. Enjoy.

copy getWeblogsChanges() to {success, theFile}

if not success then
display dialog "Could not get the changes file from Weblogs.com."
end if


on getWeblogsChanges()
set changesSource to "http://www.weblogs.com/changes.xml"
set theDate to current date
set theYear to year of theDate as string
set theMonth to month of theDate as string
set theDay to day of theDate as string
set theTime to time of theDate as string
-- need to prompt for the user's directory instead
set theFileName to "~/" & theYear & theMonth & theDay & theTime & "_changes.xml"
set theShellCommand to "curl " & changesSource & " > " & theFileName
--need error handling
do shell script theShellCommand
return {true, theFileName}
end getWeblogsChanges

on processWeblogsChanges(theFile)
set theShellCommand to "gzip -c " & theFile & " >>changesxml.gz"
do shell script theShellCommand
end processWeblogsChanges

Momentary lapse of reason

I was a bit panicked earlier tonight; I came home and the Power and PC Connection lights on the cable modem were blinking in sequence, then stopping, then restarting. Usually a sign that someone somewhere has screwed up my cable modem service. Tonight that would have been a very bad thing. No video chat with Lisa and her folks, potentially a full day of Weblogs.com data missed, no blogging tonight…

After a bit, I stopped hyperventilating, called Lisa the old fashioned way on the phone, watered the garden, ate dinner, and watched a bit of This Old House. When I picked up the computer later, everything was working again. Bliss!

Hanging out
In the street
The same old thing
We did last week
Not a thing to do
But blog and try to parse XML

…er, something like that.…

Different but equal

Here’s a feature that Office 2003 has (and maybe Office XP, too) that Office X for the Mac doesn’t. Somewhat to my chagrin. In Office 2003, you can import an arbitrary XML file, with or without a DTD, into a regular old Excel worksheet.

Why might you want to do such a thing? Think data acquisition and analysis on the cheap, without having to write an XML parser to understand the data. Say, for instance, you’re bringing in about 200K of XML data from Weblogs.com every hour for two weeks and you want to look at, munge, and export it quickly to a format that can be imported by a SQL database. Possible using Excel 2003. Not possible using Excel X for Mac.

Little known not-secret: Excel X for Mac is a completely separate code base from the Windows versions of Excel, produced by a different team in a different division. Good news: this means it acts more like a Mac product (remember Word 6?). Bad news: sometimes major features go missing.

BloggerCon, and you’re invited

Have I commented yet on the terrible irony that I left Boston and its environs just as Dave Winer, the Blogfather, was moving there? Yes? Ok, moving on to the main topic: BloggerCon, the first convention specifically for bloggers, is October 4 at Harvard Law. Registration online. The conference is invitation only, which may explain why I can’t find all the details on the main site, but here’s some goodies from the invitation:

4. Presenters include Glenn Reynolds, Joshua Marshall, Doc Searls, Scott Rosenberg, Adam Curry, Elizabeth Spiers, Jim Moore, Susan Mernit and more. Moderators: Lance Knobel, Ed Cone, Christopher Lydon and myself. And new discoveries, people we hadn’t heard about until we set out to find the most interesting and eclectic blogs and bloggers.

5. We’re going to talk about how weblogs are used in politics, business, journalism, the law, medicine, engineering and education. And it’s Harvard so you know it tastes good and is good for you too. ;->…8. Our local host committee of Boston-based bloggers includes Cluetrain author David Weinberger, InfoWorld’s Jon Udell, author Halley Suitt, MIT’s Andrew Grumet and Tracey Adams, Harvard librarian Jessica Baumgart and Larry Bouthillier from Harvard Business School.

Maybe I can talk Lisa into a trip back East for a four or five day weekend…