Hello list, I am trying to write a short AppleScript that will extract several properties of an e-mail in Entourage 2004 to produce a summary and put it on the clipboard. I can get all of the properties of the e-mail message I want except the recipient of the e-mail. I get error messages when I try to get that property. I have tried to work around it using try statements and typing in the recipient after I paste the summary just to make it work, but would like to get the whole summary in one piece. Any ideas?
If I remove the “try” statement from
try
set emailRecipient to the address of the recipient of theMsg as text
end try
then I get this error: Can’t make «class addr» of «class rcpt» of «class inm » id 100723 of application “Microsoft Entourage” into type string.
If I remove “as text” then I get this error: Microsoft Entourage got an error: Can’t get address of recipient of incoming message id 100723.
It almost seems like Entourage is blocking me. Are there any Entourage scripting wizards that know a way to do this?
Here is the script:
set emailSender to ""
set emailDate to ""
set emailRecipient to ""
set emailSubject to ""
set emailContent to ""
tell application "Microsoft Entourage"
activate
try
if window 1 = main window then
set theMsg to item 1 of (get current messages)
end if
end try
try
set emailSender to the address of the sender of theMsg
end try
try
set emailDate to the time sent of theMsg
end try
try
set emailRecipient to the address of the recipient of theMsg as text
end try
try
set emailSubject to the subject of theMsg
end try
try
set emailContent to the content of theMsg
end try
set citation to "From: " & emailSender & return & "Date: " & emailDate & return & "To: " & emailRecipient & return & "Subject: " & emailSubject & return & return & emailContent as text
set the clipboard to citation as text
end tell
Model: MacPro 3.0 GHz Quad
AppleScript: 1.10.7
Browser: Safari 419.3
Operating System: Mac OS X (10.4)