Getting Text Selection in Apple Mail

I’m trying to figure out how to either 1.) copy a text selection in Mail to the clipboard (to later be pasted into a Filemaker database), or 2.) pass the selected text (with all formatting) directly to a field in Filemaker.

The latter can be accomplished for the entire body of an email message using:

set cell “TheTargetField” of last record of the table “SomeFMTableName” to TheBody

where TheBody has been defined as the body of the email using:

set TheBody to get content

The two problems with that method are that it returns the entire body of the message, rather than just the selected text, and it does not preserve any formatting. Copying the selection to the clipboard seems like an easy way to do it, but I can’t figure it out.

All help is appreciated.