[X Newbies] Apple's Mail - Insert text

cricket cricket at apple.com
Wed Jul 9 13:21:50 PDT 2003


You could try this. Put this text into a Script Editor document and 
save it as an application. When you drop one or more BBEdit files onto 
it, it will paste the contents of the files into your frontmost 
outgoing message window in Mail.

on open droppedItems
	set textToAppend to ""
	repeat with eachFile in droppedItems
		tell application "Finder"
			set creatorType to creator type of eachFile
			set fileName to name of eachFile
			set theFile to open for access eachFile
			set fileContent to read theFile from 1 to eof
			close access theFile
			if creatorType is equal to "R*ch" then
				set textToAppend to textToAppend & "-----" & return & "Filename: " 
& fileName & return & return & fileContent & return & "-----" & return 
& return
			end if
		end tell
	end repeat
	tell application "Mail"
		set everyOutgoingMessage to every outgoing message
		if count of everyOutgoingMessage is greater than 0 then
			set outgoingMessage to outgoing message 1
		else
			set outgoingMessage to make new outgoing message
		end if
		tell outgoingMessage
			set content to content & return & return & textToAppend
		end tell
	end tell
end open

- cricket

On Wednesday, July 9, 2003, at 1:09 PM, Frank Eves M.D. wrote:

>>> On Wednesday, July 9, 2003, at 12:51 PM, Frank Eves M.D. wrote:
>>> I enjoy using Apple's Mail app but I miss being able to insert a 
>>> text file's content in the body of my email.
>
>> On Wednesday, July 9, 2003, at 12:54 PM, cricket wrote:
>> What kind of text files are they?
>
> BBEdit text files

----->
Software Entomologist – Mail for Mac OS X
                 http://www.apple.com/macosx/panther/mail.html
---------->
If you are not the lead elephant, the scenery never changes.





More information about the X-Newbies mailing list