William said:
Entourage 2004 does not preserve links, category assignments and a few
other features after a rebuild. Entourage 2008 does preserve all this.
I believe someone has a script for rebuilding links but I'm unable to
find it at the moment.
it would certainly be possible to script links between mail
senders/recipients and their address book entries, but manually made
links could never be retrieved.
I couldn't find such a script, so I wrote one. Note: this only works on
single folders. It could be adapted to trawl through the whole mail
folder tree - if you really need that, let me know.
Be careful when copying/saving this script - long lines in the message
window may not wrap correctly. Also, some characters may not be
displayed properly if you are viewing in a web browser.
-- Link Mail to Senders v1.0 (2008-09-08)
-- an applescript by Barry Wainwright <mailto:
[email protected]>
-- uses a selected folder or selected messages and links the recieved
messages
-- to any contacts in the address book that match the sender of the messages
-- This script released under a Creative Commons Attribution,
NonCommercial, ShareAlike 2.0 England & Wales License.
-- see <
http://creativecommons.org/licenses/by-nc-sa/2.0/uk/> for full
details
(*
Instructions
=======
Installation:
Save this script into the folder named "Entourage Script Menu Items"
This folder is inside your
"Microsoft User Data" folder in your Documents folder.
The script can now be accessed from the Script menu in Entourage
Using the Script:
1. select either: a folder in the folder listing; a single message; or
several messages
in an Entourage Mail Window.
2. If you selected a folder or a single message, the script will work
on all messages
in the current folder. If you selected several messages, the script
will work on the
selection only
3. Run the script by selecting it from the Entourage Script Menu.
That's it!
*)
tell application "Microsoft Entourage"
set theFolder to ""
try
set theSelection to selection
on error
display dialog "Please select a folder and run the script again"
buttons {"Abort"} default button 1 with icon stop
return
end try
if class of theSelection is in {folder, news group} then
set theFolder to theSelection
else
try
set theMessages to current messages
if (count theMessages) = 1 then
set theFolder to storage of item 1 of theMessages
end if
on error
display dialog "Please select a folder and run the script again"
buttons {"Abort"} default button 1 with icon stop
return
end try
end if
-- get list of all senders
set LF to ASCII character 10
set AppleScript's text item delimiters to {LF}
display dialog "Getting list of senders..." buttons {"•"} default
button 1 giving up after 1
if theFolder ≠"" then
set folderName to name of theFolder
set senderList to (address of sender of every message of theFolder) as
text
else
set folderName to "Selected Messages"
set senderList to {}
repeat with aMessage in theMessages
copy address of sender of aMessage to end of senderList
end repeat
end if
end tell
set theFile to ((get path to temporary items folder) as text) &
"senderScript"
set writeFile to open for access theFile with write permission
set eof writeFile to 0
write senderList to writeFile
close access writeFile
set theSenders to paragraphs of (do shell script "sort " & quoted form
of (POSIX path of theFile) & " | tr \"[:upper:]\" \"[:lower:]\"|uniq")
tell application "Microsoft Entourage"
repeat with aSender in theSenders
set senderContact to find aSender
if (count senderContact) > 0 then
set messageList to (every message of theFolder whose address of
sender is aSender)
link messageList to senderContact
end if
end repeat
end tell