Re: scripting the Address Book
Re: scripting the Address Book
- Subject: Re: scripting the Address Book
- From: Paul Berkowitz <email@hidden>
- Date: Sat, 23 Oct 2004 13:32:45 -0700
On 10/23/04 10:55 AM, "Shoshanna Green" <email@hidden> wrote:
> I'm starting to get my feet wet in Applescript by trying to add some
> functionality to Address Book -- and no surprise, I'm confused.
>
> Is it possible to use Applescript to add a custom date to a card? I
> want to add one with label "info sent" and value today's date. Later,
> I'll want to be able to remove the custom date field, too. But I can't
> work out whether this can be done, let alone how . . . Advice
> gratefully appreciated!
>
set today to current date
set time of today to 0 -- midnight today
tell application "Address Book"
set c to person "Test Tester"
make new custom date at end of custom dates of c with properties
{label:"info sent", value:today}
save addressbook
end tell
(It will work with 'current date' - including the minutes and seconds, too,
and will display just the day, but may be harder to track down later. I'd
recommend setting the time to a standard time - you could use "12:00 PM" as
Address Book itself does for birthdays. That would be
set time of of today to (12 * hours)
This should work but doesn't:
tell application "Address Book"
set c to person "Test Tester"
delete (every custom date of c whose label is "info sent")
save addressbook
end tell
It produces an error. So does doing it as a repeat loop, even deleting
'count of (every custom date of c whose label is "info sent") to 1 by -1'.
Another bug. You can't delete a custom date by script.
--
Paul Berkowitz
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden