On 7/30/02 8:33 PM, "Peter Wait" <[EMAIL PROTECTED]> wrote:
Paul BerkowitzPeter Wait
Here is my attempted AppleScript to move several items to the “Notes”, following the suggestions at the bottom below:
tell application "Microsoft Entourage"
set selc to every contact whose (birthday � "" or nickname � "" or anniversary � "")
repeat with i from 1 to (count my selc)
set c to item i of my selc
tell c
if its nickname � "" then
set its description to ("Nickname: " & (get its nickname) & return)
end if
if its birthday � "" then
set its description to ("Birthday: " & (get its birthday) & " [" & (get its age) & "]" & return)
end if
if its anniversary � "" then
set its description to ("Anniversary: " & (get its anniversary) & return)
end if
end tell
end repeat
end tell
But I’m afraid running it could mess up my address book. What folder contains the Entourage addresses, so I can save it elsewhere, and then restore it if need be? Also, if there are any glaring errors, I’d appreciate the feedback.
1. The logic isn't good, Peter. You would mess up your Address Book this way.
Your initial list of contacts consists of every contact which has a nickname, a birthday or an anniversary listed. that's good. But some of them will have two or all three of these properties. Yet your script will only allow the last item into the notes. Furthermore you're going to wipe out any Notes that are already there. i already showed you how to do this, I think, and i believe Allen did too. You have to set a variable to the current notes, then add on to it these extra values, then finally at the end reset the notes to the accumulated value.
tell application "Microsoft Entourage"
set selc to every contact whose (birthday � "" or nickname � "" or anniversary � "")
repeat with i from 1 to (count my selc)
set c to item i of my selc
tell c
set theNotes to its description
if theNotes � "" then set theNotes to theNotes & return
if its nickname � "" then
set theNotes to theNotes & ("Nickname: " & (get its nickname) & return)
end if
if its birthday � "" then
set theNotes to theNotes & ("Birthday: " & (get its birthday) & " [" & (get its age) & "]" & return)
end if
if its anniversary � "" then
set theNotes to theNotes & ("Anniversary: " & (get its anniversary) & return)
end if
set its description to theNotes
end tell
end repeat
end tell
2. There is no separate file or folder for the Address Book. You'd have to back up your whole identity. In Entourage X that's here:
["Home"]/Documents/Microsoft User Data/Office X Identities/Mail Identity/
[or whatever you might have renamed your identity to]
which you might have discovered this way:
tell application "Microsoft Entourage" to get path to MUD
if you'd known about it.
Thanks very much, Paul. The script does just what I wanted, as far as it goes. Now that I’m getting so good at AppleScripts :), I’d like to add a few things a little more advanced.
I’d like to update the Notes, only if the category is “family” or “friends”. But I see that category is a list. So I’m afraid that I just can’t say “if category = ‘family’ or ‘friends’.
Similarly, if “children” are listed, I’d like to show them in my Notes, but again it is probably not as simple as “set theNotes to get its children”.
And, can I set Custom date 1, which is text, to modification date, which is type date. Or is a translation required?
And finally, if a business address is present, I’d like to show it in the Notes as a secondary address. But how do I qualify address, city, etc. so that I’m not referring to the home address?
Thanks in advance for your trouble.
Peter
