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 17:23:14 -0600
BBBWWWWWAAAAAAAHHHHHHHAHAHAHAHAHAHA
I figured it out. I needed an extra set of {} around it:
set XML contents of anItem to XML contents of anItem & {{class:XML
element, XML tag:"Contact", XML attributes:{|Uid|:z_Uid,
|FirstName|:first name of aCard, |LastName|:last name of aCard}}}
That works!!!!
Darwin
On Wednesday, March 12, 2003, at 04:10 PM, Darwin Zins wrote:
>
This seems to work very well:
>
set newCard to make new person with properties ,
>
{first name:z_first_name, middle name:z_middle_name, last
>
name:z_last_name, suffix:z_suffix, job title:z_job_title,
>
organization:z_organization, note:z_note}
>
tell newCard
>
if z_home_phone is not "" then
>
make new phone at beginning of phones with properties {label:"home",
>
value:z_home_phone}
>
end if
>
...
>
>
I have two things left to do. One is if a person is added to the Apple
>
Address Book, I need to create that person in the Zaurus Address Book
>
(which means add it to the XML contents) and if a person is deleted
>
from the Apple Address Book, I need to delete that person from the
>
Zaurus Address Book (which again means to delete that person from the
>
XML contents). Adding I think is crucial, deleting I can live without.
>
I haven't tried to figure out how to delete, but I have tried all
>
kinds of things to add, but I can't get it to work.
>
>
My code is:
>
tell application "Address Book"
>
save addressbook
>
repeat with theCard in every person
>
set aCard to properties of theCard
>
repeat with anItem in XML contents of theXML
>
-- code snipped
>
>
-- didn't find in the Zaurus Address Book, so add it
>
if found_in_z is false then
>
set z_Uid to (my get_z_uid()) as string
>
tell me to display dialog z_Uid & " " & first name of aCard & " " &
>
last name of aCard
>
>
-- Here I am trying to add just a simple element
>
set XML contents of anItem to XML contents of anItem &
>
{class:XML element, XML tag:"Contact", XML
>
attributes:{|Uid|:z_Uid, |FirstName|:first name of aCard,
>
|LastName|:last name of aCard}}
>
end if
>
>
-- code snipped
>
>
Then down below
>
set theXMLSource to generate XML theXML
>
>
This statement errors out when I have a record to add and it just says
>
"Can't continue.". Is there a way for me to debug this somehow? Am I
>
doing this wrong? To append items to the attributes of an element I
>
do:
>
set XML attributes to XML attributes & {|BusinessCountry|:country of
>
aAddress as string}
>
>
And this works fine.
>
>
Any XML Tookit Experts can help me? How do you append an element to
>
the XML contents? When that gets figured out, how do you delete an
>
element from the XML contents?
>
>
Thanks greatly, this is really driving me crazy.
>
>
Darwin
>
>
On Wednesday, March 12, 2003, at 02:23 PM, John Delacour wrote:
>
> No comprendo! Surely this should work, and according to the event
>
> log, it does work, but I can run this script a thousand times and end
>
> up with not a single Joe Bloggs in my address book. So far as I can
>
> see Address Book is simply another badly broken affair like Mail. I
>
> do wish someone would tell us what's going on.
>
>
>
>
>
> tell application "Address Book"
>
> set p to {nickname:"J_Bloggs", name:"Joe Blox"}
>
> make person with properties p
>
> properties of result
>
> end tell
>
>
>
>
>
>
>
> tell application "Address Book"
>
> make with properties {nickname:"J_Bloggs", name:"Joe Blox"} new
>
> person
>
> person id "5ED3C66C-54C7-11D7-AD8C-00039357DBA6:ABPerson"
>
> get properties of person id
>
> "5ED3C66C-54C7-11D7-AD8C-00039357DBA6:ABPerson"
>
> {birth date:missing value, organization:missing value, class:person,
>
> modification date:missing value, job title:missing value,
>
> title:missing value, phonetic first name:missing value,
>
> nickname:"J_Bloggs",
>
> id:"5ED3C66C-54C7-11D7-AD8C-00039357DBA6:ABPerson", home page:missing
>
> value, middle name:missing value, first name:missing value, name:"",
>
> maiden name:missing value, note:missing value, suffix:missing value,
>
> last name:missing value, creation date:date "Wednesday, March 12, 2003
>
> 8:15:29 pm", phonetic last name:missing value}
>
> end tell
>
> _______________________________________________
>
> 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.
_______________________________________________
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.