[Pythonmac-SIG] O'Reilly article, iPhoto scripting, Python?

has hengist.podd at virgin.net
Mon Mar 1 15:17:08 EST 2004


Dinu Gherman wrote:

>I just found this article about scripting iPhoto on the net which
>gives examples in AppleScript and some other P-language, so I wonder
>if this kind of stuff can be done nowadays in Python, too?

Yes. Appscript isn't quite finished yet, but it's getting close. 
Here's the equivalent deletion script [1]:

     from appscript import *

     app('iPhoto.app').photo_library_album.photos.test(
             (its.width < 200) .OR (its.height < 200)
             ).remove()


There's some sample scripts on my site and bundled with appscript 
itself, and I'll release more as I write them.

HTH

has

[1] Brian's original Perl script makes the classic faux-pas of 
laboriously iterating where a filter reference would do. See past 
posts from me regarding application object references, pointing out 
that they're actually queries and not conventional OO object 
references as many folks assume.
-- 
http://freespace.virgin.net/hamish.sanderson/



More information about the Pythonmac-SIG mailing list