Hi All,
Nice code snippet, but why does Mail report back an array where the 'current application' is the first element? Why is the application it self listed as an attachment:
get every attachment of content of message id 460789 of mailbox "INBOX" of account "NetPoint"
{current application, mail attachment id "2.2" of message id 460789 of mailbox "INBOX" of account "NetPoint", mail attachment id "2.3" of message id 460789 of mailbox "INBOX" of account "NetPoint"}
In some bizare situations, it even list the application twice in stead of the actual two attachements:
get every attachment of content of message id 468133 of mailbox "INBOX" of account "NetPoint"
{current application, current application}
Mail.app on Mac OS X 10.4.2
Jakob Peterhänsel
"Tell me why, don't we try, not to break our hearts
and make it so hard for our selfs"
P.S.B. 1987
AIM: Marook
Phone: +45 22684961
On 25/08/2005, at 18:43, Automated Workflows, LLC Mailing Lists wrote:
In Mail, an attachment is not an element of a message, it is an element of the content of a message. That said, the following code seems to work for me now to save attachments from Mail in Tiger.
set theOutputFolder to (choose folder) as string
tell application "Mail"
set theSelection to selection
set theMessage to item 1 of theSelection
set theAttachments to every attachment of content of theMessage
repeat with a from 1 to length of theAttachments
set theAttachment to item a of theAttachments
try
set theAttachmentName to name of theAttachment
set theSavePath to theOutputFolder & theAttachmentName
save theAttachment in theSavePath
end try
end repeat
end tell