Before lunch I sat in on a session on using Python to interface with Applescript. Appscript is used to create a bridge between Python code and Applescript. Here’s a quick code snippet to give you an idea what Appscript can do:
from appscript import *
f = app.("Finder.app")
f.help # shows what you can do with it, very nice.
f.desktop.disk[1].free_space.get()
# gives you an insane number of bytes free
Slick indeed. There was also a slick demo to script OmniGraffle to generate a nice looking sitemap using Python, Appscript, and Beautiful Soup. For more cool hacks, check out these examples.
That script, by the way, is at http://toys.jacobian.org/presentations/2005/appscript/generate-site-map.txt.
(I’m glad you liked the presentation
Is information about the demo using OmniGraffle available anywhere? I’d like to look at that code.
Jim,
I’m not sure if Jacob Kaplan-Moss is planning on putting his slides online, but you might want to check out his website (http://jacobian.org) or send him an email.
the example has a few typos in it. this is what worked for me:
from appscript import *
f = app("Finder.app")
f.help() # shows what you can do with it, very nice.
f.desktop.disk.free_space.get()
Hey guys –
The slides are available at http://toys.jacobian.org/presentations/2005/appscript/.
Jacob