MACSCRPT Archives

August 2011

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Bill Steele <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Fri, 19 Aug 2011 17:05:27 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (43 lines)
On Aug 18, 2011, at 2:28 PM, John Delacour wrote:

> At 13:04 -0400 18/08/2011, Bill Steele wrote:
> 
> 
>> Getting the text of an incoming message in Apple Mail is pretty 
>> straightforward (albeit not intuitive):
>> 
>> tell application "Mail"
>> set mySel to selection
>> set Msg to item 1 of mySel
>> set msgText to content of Msg
>> end tell
>> 
>> (Why those lines won't combined escapes me)
> 
> Probably because you tried ...item 1 of selection..., which would 
> have worked in the old days but not under the new order.
> 
> 
> tell application "Mail"
> 	set _msg_body_as_text to content of item 1 of (get selection)
> end tell

Both approaches produce the same result, on a Snow Leopard machine and a Panther machine (Don't ask).  It's something about the e-mail message, not the code.

> 
> 
>> Works fine most of the time, but every so often I hit a message 
>> where the result is
>> 
>> "?"
> 
> What do you get if you ask for 'source' rather than 'content', which 
> gives you a plain text conversion of the message body?

That works -- in both code formats -- and will do what I need. Thanks. 



Bill Steele
[log in to unmask]

ATOM RSS1 RSS2