On Feb 8, 2007, at 4:06 AM, John Delacour wrote: > At 5:46 pm +0100 6/2/07, J.L. Slangen wrote: > >> ... I have not discovered in the Mail.app Dictionary any command >> that moves an attachment from inside Mail to outside Mail. That is >> to say, I am unable to get the "move", "make" and "save" commands >> to do anything that comes near to what the aforementioned Save >> button accomplishes. Any suggestion? > > You can get the source of the message > > tell application "Mail" > set _message to item 1 in (get selection) > set _source to source of _message > end tell > > then parse it to extract the base64-encoded data of the attachment, > decode this using Perl, munpack or something, and write to a file. > It's not too difficult once you've done it. An attachment can't be assumed to be base64-encoded. As one example, Outlook 2000, if its global option for the form of styled text is rich text (the default in a fresh-from-the-box installation) rather than HTML, encodes PDF attachments (and perhaps others, or perhaps not) to styled messages in quoted-printable. Actually, it's worse than that: Outlook in that state encodes a PDF in faulty quoted-printable. Outlook 2000 can read the result and reproduce the document OK; other clients, including Outlook Express (Windows), Eudora (Windows and Mac), and Apple's Mail.app produce broken PDF documents that crash the then-current Acrobat Reader (now, of course Adobe Reader), and the full Acrobat. We learned this one in an excursion to the web after we got a support call that one of three recipients of a draft of a brochure could not read the document. It turned out that the successful recipients were also using Outlook 2000; the other was using Outlook Express. The solution was to change the sender's Outlook 2000 global preference for styled text to HTML. (In that situation, Outlook encodes the attachment successfully in base64.) --John