Select html text


I’ve written a script which takes the selected text in DT and inserts it into an email with the proper address and subject. My problem is that the selected text is often html with linked text which I would like to preserve. The text in the email is plain text. Is there a way to make sure it is html?

Here is the code:

Take selected text and email it to
tell application id "com.devon-technologies.thinkpro2"
	set theRecord to content record
	set theAddress to ""
	set theName to name of think window 1
-- Dont want the name of the database in the subject
	set Start to offset of "—" in theName
	set theSubject to (texts (Start + 3) thru -2 of theName)

	set theURL to the URL of think window 1
	set theBody to selected text of think window 1
end tell

tell application "Mail"
	set newMessage to make new outgoing message with properties {subject:theSubject, content:theURL & return & return & theBody & return & return}
	tell newMessage
		-- Default is false. Determines whether the compose window will
		-- show on the screen or whether it will happen in the background.
		set visible to true
		make new to recipient at end of to recipients with properties {address:theAddress}
	end tell
	-- Bring the new compose window to the foreground, in all its glory
end tell

Tom S.

Perhaps others know better, but I don’t think so.

You can get the “selected text” of a window, and you can get the entire content of any record as HTML, but there’s no easy way to relate the two.

HTH, Charles

Thanks for the reply.

So maybe there’s a way to copy the contents onto the clipboard and paste them in?