Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

dvkid

macrumors regular
Original poster
Feb 18, 2006
176
68
I want to make an AppleScript that takes the body the selected email message and turns it into a text file (XML). The email body will already bare all necessary XML formatting. The script would literally emulate copying the body and pasting it into TextEdit and doing a Save As with extension XML. I could easily build a Script or Automation that takes the clipboard but haven't found a way to capture the body of the selected email.

Anybody know?
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
This AppleScript will grab the content of the 1st selected message into a variable. What you do with it then is up to you

Code:
tell application "Mail"
	set theSelectedMessages to selection
	set the selectedMessage to item 1 of theSelectedMessages
	set myContent to content of selectedMessage
end tell
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.