Does anyone know of a function or a script that I could apply to a mail
folder in order to extract the email addresses contained within the messages
in the folder?
Absolutely. AppleScript is made for this. : )
Paste this into /Applications/AppleScript/Script Editor, then save it
as a Script named "Extract Sender Addresses" into the
~/Documents/Microsoft User Data/Entourage Script Menu Items folder. To
use the script, select a group of messages in Entourage, then choose
Extract Sender Addresses from the Entourage script menu. The addresses
will be placed on the clipboard, ready to be pasted wherever you want.
-- begin script
-- sets the clipboard to a list of the senders of all selected messages
property pDelimiter : ", "
property pIncludeDisplayName : true
set senderList to {}
tell application "Microsoft Entourage"
set messageList to the current messages
repeat with nextMessage in messageList
set sName to nextMessage's sender's display name
set sAddress to nextMessage's sender's address
if pIncludeDisplayName then
set sPerson to sName & " <" & sAddress & ">"
else
set sPerson to sAddress
end if
if senderList does not contain sPerson then
set the end of senderList to sPerson
end if
end repeat
end tell
set saveDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to pDelimiter
set textList to senderList as text
set AppleScript's text item delimiters to saveDelims
set the clipboard to textList
-- end script
Some options:
If you'd rather have the list of addresses be delimited by a return
character, change this line like so:
property pDelimiter : return -- ", "
If you'd rather not include display names, change this line like so:
property pIncludeDisplayName : false -- true
Questions?