Jump to content

get text from mail message content


rikw
 Share

3 posts in this topic

Recommended Posts

Hi

 

I'm trying to get the text (from content) out of selected mail messages and paste that text into a textEdit document using applescript.

 

My attempt gets stuck between the two apps I think?

tell application "Mail"
get selected
set para1 to "content"
end tell

tell application "TextEdit"
activate
make new document
open document window
end tell

 

My next plan was to set the new textEdit document text to para1, but this must transgress OO rules I haven't learned yet so does not compile / run.

 

Any help appreciated to move this on a stage or two please/

regards and tia

rik

Link to comment
Share on other sites

  • 4 months later...
  • 2 months later...

Is this what you need it to do?

tell application "Mail"
set selectedMessages to selection
if (count of selectedMessages) is equal to 0 then
	display alert "No Messages Selected" message "You must select a message first."
else
	set theMessage to item 1 of selectedMessages
	set theContent to content of theMessage
	tell application "TextEdit"
		activate
		make new document
		tell the front document
			set paragraph 1 to theContent
		end tell
	end tell
end if
end tell

Link to comment
Share on other sites

 Share

×
×
  • Create New...