AppleScript bug: When placing plain text on the clipboard, the text is always converted to rich text
Solution 1:
Maybe copying the text to the Pasteboard using Cocoa-AppleScript will only set plain text to paste to the RTF document.
Otherwise, use the following as a workaround:
set testString to "This string should be plain text." as string
do shell script "pbcopy <<<" & quoted form of testString
The previous mentioned workaround method adds a linefeed
after testString
to the Clipboard and if that's unwanted behavior, use:
set testString to "This string should be plain text." as string
do shell script "printf " & the quoted form of testString & " | pbcopy"
The other option is to use Paste and Match Style ⌥⇧⌘V instead of Paste ⌘V to match what's at the insertion point.