Simple TextEdit document creation fails -10000

Really simple actions attempted here. Create a TextEdit document and stuff text into it.

set theText to "A bunch of text records, each can be 100 characters long, and over 100 records (using returns)..."
tell application "TextEdit"
	activate
	set txtDoc to make new document with properties {text:theText}
	--Fails here with AppleScript Execution Error and TextEdit even crashdumps.
end tell

Further info on the error is:
TextEdit got an error: AppleEvent handler failed.
/System/Applications/TextEdit.app
-10000

???

Hi Oxylos.

It works fine here — provided that the theText is a single AppleScript text and not a list or something else. Have you checked the input?

BTW. I’ve edited the script in your post so that it appears here in a box with an “Open in Script Editor” button. The trick is to post using plain text and to put three backticks on separate lines above and below, eg.:

```
set theText to "A bunch of text records…"
– etc.
```