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

Laurent Pierron Laurent.Pierron at loria.fr
Tue Mar 2 11:58:09 EST 2004


Oh Yes, very exciting, so the AppleScript is :

tell application "iPhoto"
	remove (photos of photo library album where height < 200 or width < 
200)
end tell

In Python, I'll like to write that :

import iPhoto
map(iPhoto.remove, [photo for photo in 
iPhoto.photo_library_album.photos if photo.width < 200 or photo.height 
< 200])

Why isn't it possible ?

Le 1 mars 04, à 21:17, has a écrit :

> 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/
>
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
>
--
Laurent PIERRON




More information about the Pythonmac-SIG mailing list