Friday, June 17, 2005

iCal hack to print events

Originally posted: Fri, 17 Jun 2005 19:13:47

NOTE: This hack is no longer available due to subsequent changes in how iCal stores files -- I never got around to recoding the script, and now the original files are lost in the mists of time.

One reason I've been trying out different pieces of software for time management is that iCal doesn't have a way to print a list of events. You can print out calendars by day, week, and month, but you can't print out the tabular list that you get from doing an incremental search. That's too bad -- it's not a hard piece of functionality to implement, and it's tremendously useful.

When I ran across an article on how to use Ruby to print iCal events, then, I was interested. Especially since the hack allows a lot of latitude in formatting. The original hack prints out today's and tomorrow's events from all calendars to text columns on the terminal. I'm more interested in multiday projects in a nicer format. So I spent a few hours teaching myself Ruby and came up with this:

The HTML file gets generated through a modified Ruby script (attached: projects.rb) whose output is piped into an HTML file (attached: printprojects.sh). The HTML file (attached: projects.html) is formatted with some basic CSS (attached: projects.css).

To try this out:

1. Download Ruby and install it.

2. Download all the files below. Save them to the Desktop or whatever folder you like, as long as they're in the same folder.

3. Open the Terminal and navigate to the folder.

4. Type: "chmod +x printprojects.sh"

5. Open iCal, create a calendar called "projects", and enter some events. Close iCal.

6. From the Terminal, type "./printprojects.sh".

7. In your web browser, navigate to the directory and open "projects.html". Your events should be in there.

The Ruby code is ugly as can be, and large chunks don't do anything. And it's hard-coded to produce exactly the output I want. If anyone wants to undertake some cleanup and revision, please be my guest!

>

Blogged with Flock

No comments: