Changing text styles

The following applescript obtains the selected text from within a web page and adds the title of the page along with the date that the page was last modified and the current date. I would like to be able to change the last modified date and the current date to a smaller font and make it in italics. Can anyone suggest a way of doing this without launching another application.

tell application "Safari"
	set selecTxt to (do JavaScript "(getSelection())" in document 1)
	set pgTitl to (do JavaScript "document.title" in document 1)
	set pgDate to (do JavaScript "document.lastModified" in document 1)
	set myURL to URL of front document
	set copyText to selecTxt & return & return & pgTitl & return & myURL & return & "Last Modified:" & pgDate & return & (current date)
	set the clipboard to copyText
end tell

Applescript only handles plain text, not rich text, so the answer is no.

However, html code is plain text. So you could create the text of the html code, and of course html would allow you to add formatting attributes. I’m not certain where you propose to use the clipboard text but maybe the html code suffices? If you need rich text, then you could write the html code to a file. Then use the command line utility “textutil” to convert the html file to an rtf file. If the program where you want to use the rich text can read in from a file this might also be a solution.

To summarize, in general the answer is no. However you do have some options depending on how/where you want to use the text. And of course you can always use another application if nothing else works for you.