python on mac (os x): application automation

L

Leo

hi there

i have just started with mac development and i use applescript at the moment
for iTunes and iPhoto automation.

but i'd like to do it from python. does anybody know weather that's
possible and if there is a add on for that?

thanks, leo
 
M

Mitch Chapman

Leo said:
hi there

i have just started with mac development and i use applescript at the moment
for iTunes and iPhoto automation.

but i'd like to do it from python. does anybody know weather that's
possible and if there is a add on for that?

thanks, leo

Bob Ippolito has built aeve for just such purposes.
He recently announced aeve 0.0.3; you can find the announcement
here:

http://mail.python.org/pipermail/pythonmac-sig/2003-September/008692.html

Because I am lazy and do not read documentation :) I just downloaded
all of the source distributions from his website. He also provides
binary distributions, which can be installed using PackageManager.

To build aeve for Python 2.3 from source, you'll need to
download and install each of these tarballs, using the usual
'sudo python setup.py install' incantations:

http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/Pyrex-0.8.2.tgz
http://undefined.org/python/TECManager-0.1.tgz
http://undefined.org/python/LaunchServices-0.1.tgz
http://undefined.org/python/aeve-0.0.3.tgz

Bob's announcement includes sample code showing how to get the
name of the currently-playing iTunes track. He also provided the
following variation, which works if you happen to be playing
no tracks:

#!/usr/bin/env pythonw
import aeve
iTunes = aeve.talkto('com.apple.iTunes')
if iTunes.player_state == 'playing':
print iTunes.current_track.name
else:
print "iTunes is not currently playing a track"

Please also note that, in order to use aeve, you will
probably need to invoke python as pythonw (or run from within
a MacPython IDE) so you can talk to the window manager.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top