• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Mail and Attachments
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mail and Attachments


  • Subject: Re: Mail and Attachments
  • From: "Automated Workflows, LLC Mailing Lists" <email@hidden>
  • Date: Sat, 24 Sep 2005 20:11:03 -0400

Jakob,

Yes, I noticed this too.  Seems to be a bug in Mail.  That's why I wrapped the attachment retrieval code in a try block.

-Ben

On Sep 24, 2005, at 5:01 PM, Jakob Peterhänsel wrote:

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

Email:     email@hidden
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




Benjamin S. Waldie

President & CEO

Automated Workflows, LLC

610.935.0652

=============================================

AppleScript and Workflow Automation

Consulting - <http://www.automatedworkflows.com>

AppleScript Info - <http://www.applescriptguru.com>

AppleScript Training - <http://www.applescripttraining.com>

=============================================


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: Dave Lyons
  • Next by Date: Re: Dave Lyons
  • Previous by thread: Re: Drilling down into an AppleScript object reference
  • Next by thread: Object inheritance question...
  • Index(es):
    • Date
    • Thread