Re: Remove Fields From Record?
Re: Remove Fields From Record?
- Subject: Re: Remove Fields From Record?
- From: Michelle Steiner <email@hidden>
- Date: Mon, 1 Aug 2005 21:54:04 -0700
On Aug 1, 2005, at 7:23 PM, Gary Beberman wrote:
This is what I saw in the Address Book dictionary:
person n, pl people [inh. entry > item] : A Person Record in the
address book database.
Doesn't that mean a "person" object is a record?
My plan was to compare the people records themselves to see if they
were identical. That way, I would not have to figure out if new
information (e.g. an additional work phone number) had been entered
for the person. But, to do so successfully, I was going to have to
take out the fields which made the record itself unique (e.g. ID).
A person is an object with properties; it looks like an applescript
record, but it isn't.
Therefore, I wanted to pull a person record with all of its data
and drop from it the following fields:
- creation date
- modification date
- id
- vcard
All of those properties are read only; you can't change them;
therefore, you can't drop them. But why would you want to drop them?
So, if I could compare two person records, I could determine the
dupes without have to check every field in the record. If R1 = R2,
the record would be a dupe.
That is easy. Here is sample code.
tell application "Address Book"
set r1 to my extract_names(person 1)
set r2 to my extract_names(person 2)
if r1 is equal to r2 then
--same person
else
--different people
end if
end tell
on extract_names(the_person)
tell application "Address Book"
return {first name, last name}
end tell
end extract_names
-- Michelle
--
Power is the ability to not have to please.
_______________________________________________
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