How do I relink freshly imported email to addresses in Address Book?

S

Steve J

Folks,

Have just come back to Entourage after 6 months in Mail.app. I
imported my mail first using the Import Mail script, then used Paul
Berkowitz's Sync Entourage-AB script to import all the Apple Address
Book contact info.

I now need to link the email in my different folders to contacts in
Entourage's Address Book. It may be glaringly obvious but I just
cannot see how to link them.

Any suggestions appreciated.

Steve Jamieson
 
P

Paul Berkowitz

Have just come back to Entourage after 6 months in Mail.app. I
imported my mail first using the Import Mail script, then used Paul
Berkowitz's Sync Entourage-AB script to import all the Apple Address
Book contact info.

I now need to link the email in my different folders to contacts in
Entourage's Address Book. It may be glaringly obvious but I just
cannot see how to link them.

Do you mean real Entourage links (as in the preferences "Automatically link
contacts with the messages I receive from them" and "Automatically link
contacts with the messages I send to them") or applying categories (as in
the preference "Automatically match message categories to senders'
categories"), or both?

It could be done by script, per folder, and would be very slow. I don't of
any other way. Dragging the messages or folders out and in doesn't do it.

And any other type of individual links (not to senders) would have to be
done manually by you.

You could run this from Script Editor, but it will be quicker if you save it
as a Script (compiled script) to the Entourage Script Menu Items in the
Microsoft User Data folder i your user's Documents folder and run it from
the script menu.

Select a folder before running it. Repeat for every folder except Drafts and
Deleted Items.

-------------------------

tell application "Microsoft Entourage"
try
set theFolder to displayed feature of main window
if class of theFolder ‚ folder then error number -128
on error
beep 2
display dialog "You first have to select a folder in tehb main
window." buttons {"Cancel"} default button 1 with icon 0
end try

repeat with theMsg in (every message of theFolder)
try -- if anything is wrong, just skip
if class of theMsg is incoming message then
set eAddress to address of sender of theMsg
-- will error and skip if no contact
set theContact to item 1 of (find eAddress)
link theMsg to theContact
set category of theMsg to (get category of theContact)

else if class of theMsg is outgoing message then
repeat with theRecipient in (every recipient of theMsg)
set eAddress to address of address of theRecipient
-- will error and skip if no contact
set theContact to item 1 of (find eAddress)
link theMsg to theContact
end repeat
end if
end try
end repeat
activate
beep
display dialog "All done!" buttons {"OK"} default button "OK" with icon
1
end tell

------------------------------------------

--
Paul Berkowitz
MVP Entourage
Entourage FAQ Page: <http://www.entourage.mvps.org/toc.html>
AppleScripts for Entourage: <http://macscripter.net/scriptbuilders/>

Please "Reply To Newsgroup" to reply to this message. Emails will be
ignored.

PLEASE always state which version of Entourage you are using - 2001 or X.
It's often impossible to answer your questions otherwise.
 
S

Steve J

Apologies. Forgot to note that I am using Entourage 10.1.4 under
10.3.2 on a TiBook G4
 
S

Steve J

Paul,

The compiler tells me: "Expected "then", etc. but found unknown
token"

It is highlighting the ? just after if class of theFolder on line 4.

I wouldn't know what an Applescript did if it jumped up and bit me, so
I beg your indulgence on this one.

Thanks,

Steve Jamieson

PS: and is the 1 at the very bottom of the script meant to be alone
on that line?
 
B

Bernard REY

Steve J wrote :
The compiler tells me: "Expected "then", etc. but found unknown
token"

It is highlighting the ? just after if class of theFolder on line 4.

Something must have gone wrong when copying the script. You shouldn't see a
question mark, but a crossed equal sign. To replace the "?", type the equal
symbol holding the option key. It should display "‚" (but maybe it doesn't
in the font you are using...)

PS: and is the 1 at the very bottom of the script meant to be alone
on that line?

No. That's another copy problem. There is another that should not have been
cut. Well, here's the script again, I've managed to make the lines shorter.
Hope it'll run this time:


tell application "Microsoft Entourage"
try
set theFolder to displayed feature of main window
if class of theFolder ‚ folder then error number -128
on error
beep 2
display dialog "You first have to select a folder in the main ¬
window." buttons {"Cancel"} default button 1 with icon 0
end try

repeat with theMsg in (every message of theFolder)
try -- if anything is wrong, just skip
if class of theMsg is incoming message then
set eAddress to address of sender of theMsg
-- will error and skip if no contact
set theContact to item 1 of (find eAddress)
link theMsg to theContact
set category of theMsg to (get category of theContact)

else if class of theMsg is outgoing message then
repeat with theRecipient in (every recipient of theMsg)
set eAddress to address of address of theRecipient
-- will error and skip if no contact
set theContact to item 1 of (find eAddress)
link theMsg to theContact
end repeat
end if
end try
end repeat
activate
beep
display dialog "All done!" buttons {"OK"} default button "OK" ¬
with icon 1
end tell
 
Top