Re: more info for person in Now Up-to-Date event
Re: more info for person in Now Up-to-Date event
- Subject: Re: more info for person in Now Up-to-Date event
- From: Bill Cheeseman <email@hidden>
- Date: Wed, 18 Apr 2001 09:20:01 -0400
on 4/18/01 5:07 AM, Daniel Komrska jr. at email@hidden wrote:
>
I need more information for person attached in some Now Up-to-Date event.
>
>
How can I find attached person in "mother" Now Contact file?
>
>
I know, that I can get from Now Up-to-Date "ContactLink" for this
>
person, but what shut I do with (for example) <data LNK-00002723>?
The ContactLink field is meant to be used for a different purpose, namely,
to create a link from a known person in Now Contact to a new or existing
person in Now Up-to-Date. (You do this by concatenating "L#" and the unique
id of the Now Contact person, then setting the ContactLink property of a Now
Up-to-Date person to the result.) You can't use the ContactLink property to
go in the opposite direction, finding a Now Contact person who is already
linked to a known Now Up-to-Date person, because you can't extract the Now
Contact unique id from the Now Up-to-Date ContactLink (unless perhaps you
use Ed Lai's Programmers Tool osax, which I haven't tried).
One way to do what you want is to search through all of the Now Contact
persons in a repeat loop until you find one having the same unique
identifying properties as the known person in Now Up-toDate. For example
(watch for line wrap and the AppleScript line continuation character):
tell application "Now Up-to-Date"
set NUDperson to person 1 of event 1 of calendar 1 of document 1 -- or
any known person
set NUDlastName to lastname of NUDperson
set NUDfirstName to firstname of NUDperson
set NUDcompanyName to companyname of NUDperson
set NUDworkPhone to workphone of NUDperson
end tell
tell application "Now Contact"
set NCperson to "" -- initialize
count every row of table 1
repeat with i from 1 to result
tell person i
if (last name = NUDlastName) ,
and (first name = NUDfirstName) ,
and (company = NUDcompanyName) ,
and (work phone = NUDworkPhone) then
set NCperson to it
exit repeat
end if
end tell
end repeat
end tell
A reference to your desired Now Contact person is in the variable NCperson,
or an empty string if no matching person was found.
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
The AppleScript Sourcebook - www.AppleScriptSourcebook.com
Vermont Recipes - www.stepwise.com/Articles/VermontRecipes