Re: birth date from Address Book
Re: birth date from Address Book
- Subject: Re: birth date from Address Book
- From: Darwin Zins <email@hidden>
- Date: Wed, 12 Mar 2003 13:54:37 -0600
Wow, much faster, I just switched to use properties for the contact and
only update if needed and the contained objects I just checked to see
if they changed and only update if needed and it went from taking over
two minutes to taking about twenty seconds. Of course it was already
sync'd so it didn't have to make any changes.
Thanks a bunch, now it is much more useable.
I will try some of the other things mentioned too.
Darwin
A big thing you can do that will speed things up if there are a lot of
contacts is to do this. If the repeat loop is in the top-level of the
script
(i.e. explicit or implicit run handler), then use 'my':
set thePeople to every person
repeat with i from 1 to (count thePeople)
set thePerson to item i of my thePeople
etc.
(Nigel Garvey discovered this. It's basically the same as 'a reference
to'
but even faster.) If the repeat loop is in a handler, then 'my' and 'a
reference to' won't work unless 'thePeople' is a global', but this
will -
thanks to Serge Belleudy-Espinoise (or correction):
script peopleScript
property myPeople: thePeople
end script
repeat with i from 1 to (count thePeople)
set thePerson to item i of peopleScript's
thePeople
etc.
(which won't compile in a top-level script). You see incredibly
dramatic
differences in speed when the number gets high enough (say 1,000 or
more: a
few seconds versus minutes for a simple list of strings), although not
so
much for your 400. As you suspect, the slowness you're seeing is
probably
not from iterating a repeat loop, but from re-writing every single
property
and element of every single contact. in Address Book That's going to be
very, very slow.
--
Paul Berkowitz
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.