Adapted to Lion

Thanks a lot for that script. I needed it on Lion and so I adapted it to the new layout. This is my first piece of python, so please excuse anything dumb or weird I might have done.

I also recognized that the version on your blog does not yet have the changes from 10dfdabd6bea6431c70ab732a71e67dd6d424bf2