python on mac (os x): application automation

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Leo

    python on mac (os x): application automation

    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


  • Mitch Chapman

    #2
    Re: python on mac (os x): application automation

    Leo wrote:[color=blue]
    > 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
    >
    >[/color]

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



    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:






    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('co m.apple.iTunes' )
    if iTunes.player_s tate == '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.

    --
    Mitch

    Comment

    Working...