My favorite Chandler logo

March 18th, 2007 No Comments »

Chandler logo candidate
A Chandler logo

I have to say I like this logo very much, certainly compared to any others I’ve seen. I think we should change the Triage icon to use this.

Handy iCal utility

March 1st, 2007 No Comments »
Here’s a little csh script that puts properly-named ics versions of all your ical files on the desktop.

#!/bin/csh -f
set ical_sources_dir=~/Library/"Application Support"/iCal/Sources
foreach dir ("$ical_sources_dir"/*.calendar)
    if(! -r "$dir"/corestorage.ics) continue
    set cal_name=`defaults read "$dir"/Info Title`.ics
    if(-e ~/Desktop/"$cal_name") then
        echo "File ""'""~/Desktop/$cal_name""'"" exists, skipping"
    else
        ln "$dir"/corestorage.ics ~/Desktop/"$cal_name"
    endif
end

Update: Here’s the Python version.

#!/usr/bin/env python
from glob import glob
from os.path import expanduser, expandvars
from os import system, popen, link
from string import strip

ical_sources_dir=expanduser("~/Library/Application Support/iCal/Sources")
for dir in glob("%s/*.calendar" % ical_sources_dir):
    p = popen("defaults read \"%s\"/Info Title 2>/dev/null" % dir)
    cal_name = strip(p.readline()) + ".ics"
    p.close()
    if cal_name != "":
        try:
            link("%s/corestorage.ics" % dir, 
                "%s/%s" % (expanduser("~/Desktop/"), cal_name))
        except:
            pass

When I work on day-to-day Python scripts, I wonder if there are a lot of script writers who start every script with something like:

from sys import *
from os import *
from os.path import *
from string import *
This would make writing Python more Perl-like in its availability of many functions through simple calls.