<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; ">Hey All,<DIV><BR class="khtml-block-placeholder"></DIV><DIV>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:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><BLOCKQUOTE type="cite"><DIV><FONT class="Apple-style-span" face="Courier New">#!/usr/bin/env /usr/bin/pythonw</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New"><BR class="khtml-block-placeholder"></FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New">from appscript import *</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New">from sys import stdout</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New"><BR class="khtml-block-placeholder"></FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New">appCal = app( 'iCal' )</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New">todos = appCal.calendars.filter(its.title != '').todos</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New"><BR class="khtml-block-placeholder"></FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New"># Iterate flattened list, builing a local dictionary of dictionaries, by uid</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New">local_tasks = {}</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New">for task in [ todo for cal in todos() for todo in cal ]:</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New"> uid = task.uid.get()</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New"> local_tasks[uid] = {</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New"> "completion_date" : task.completion_date.get(), </FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New"> "due_date" : task.due_date.get(), </FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New"> "priority" : task.priority.get(), </FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New"> "sequence" : task.sequence.get(), </FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New"> "stamp_date" : task.stamp_date.get(), </FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New"> "summary" : task.summary.get(), </FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New"> "description" : task.description.get(), </FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New"> "uid" : task.uid.get(), </FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New"> "url" : task.url.get(), </FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New"> }</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New"> stdout.write('.')</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New"> stdout.flush()</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New"><BR class="khtml-block-placeholder"></FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New">stdout.write('\n')</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New"><BR class="khtml-block-placeholder"></FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New">print repr( local_tasks )</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New"><BR class="khtml-block-placeholder"></FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New">stdout.write( "%d tasks\n" % len( local_tasks ) )</FONT></DIV></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV><DIV>The problem is that this appears to execute painstakingly slowly. With 60 todo items in my iCal, the script takes just over 10 seconds to run. My machine i a 2GHz Intel Core Duo iMac.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Any idea how this could be sped up?</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Thank You,</DIV><DIV>Marcin</DIV><DIV><BR class="khtml-block-placeholder"></DIV></BODY></HTML>