Jump to content
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

  • 4 months later...

Without GUI scripting (which Apple destroyed with OS updates) this is rather hard with AppleScript.

 

This might be easier with Automator, since there are scripts to grab the mail message, but it will paste the entire message instead of just a part. Vexing indeed.

  • 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

×
×
  • Create New...