Simple copy text not working

This simple script does not seem to work. I am simply trying to copy the selected text in Mail, but result keeps showing me the current clipboard (before running the script) and not the selected text in Mail. I tried this with TextEdit and on multiple computer and I get the same results. What is wrong with this?

activate “Mail”
tell application “System Events” to keystroke “c” using {command down}
delay 1 – Without this, the clipboard may have stale data.

set theSelectedText to the clipboard

theSelectedText

Try this.

tell application "Mail"
	activate
	set theMessage to item 1 of (get selection)
	set theContent to the content of theMessage
	set the clipboard to theContent
end tell

Well that does copy the entire message. But I was hoping to copy only the selected text in the body of the email.

I tried to reply last night but must have posted to the wrong place. I think the following script does what you are asking for.

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

tell application "Mail"
	activate
	tell application "System Events" to keystroke "c" using {command down}
end tell

delay 1

set theSelectedText to the clipboard

theSelectedText

Here is what I use for years.

set the clipboard to ""

tell application "System Events" to tell process "Mail"
	set frontmost to true
	keystroke "c" using {command down}
end tell

repeat # reduce the delay to the shortest required value
	if (the clipboard) > "" then exit repeat
	delay 0.1
end repeat

set theSelectedText to the clipboard

theSelectedText

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mercredi 9 janvier 2019 17:45:40

Success! Thanks so much!