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.
Comments
10 responses to “PyCon: Scripting the Mac with Python”
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
ee211f47473c…
ee211f47473c212fdf88…
This idea has become outdated
vyvoz stroitelnogo musora spb…
vyvoz musora…
How did you make this template? I got a blog as well and my template looks kinda bad so people don’t stay on my blog very long :/.
tory burch shoe sale …
Tory Burch flip flop online sale.For the younger working expat women,look at these tory burch Shoes.these tory burch flip flop are definitely fun,yet the glossy design and round-toe stay these lovely.These tory burch shoes with multiple.New arrivel Tor…