[Pythonmac-SIG] appscript with todos in iCal seams very slow
has
hengist.podd at virgin.net
Mon Aug 7 01:05:21 CEST 2006
Marcin Komorowski wrote:
> I am trying to generate a python internal structure (a dictionary of
> dictionaries) with a copy of all todo data from iCal. I got it to
> work using the following code:
> [...]
> The problem is that this appears to execute painstakingly slowly.
Apple event IPC is fairly expensive; asking applications to resolve
lots of object model 'references' (i.e. queries) especially so.
Sending a few complex queries is usually much, much quicker than
sending lots of simple ones, e.g. the following will pull all
property values from all todos in a single go:
todos = appCal.calendars.filter(its.name != '').todos.properties()
You can then rearrange this data in Python to suit your needs.
There's more information in the appscript manual: chapters 2 and 3
discuss how Apple events and the Apple Event Object Model work;
chapter 12 discusses various optimisation techniques for getting good
performance out of the system.
HTH
has
--
http://freespace.virgin.net/hamish.sanderson/
More information about the Pythonmac-SIG
mailing list