Telling TextEdit to make a new file

Hi, I’m new to Applescript and these forums, and I could use some help here.

I’m trying to use Applescript to make a new text file, with a name and extension, but I don’t really know how. I tried to use the make command, but I don’t really know how to use it :confused: I was wondering how to do this, or if there is another method I should be using.
Thanks!

p.s. If someone could tell me how to make Textedit write text on the new file, that would be great too!

Hi and welcome to MacScripter

try this


tell application "TextEdit"
	tell (make new document with properties {name:"Hello"})
		set its text to "Hello World"
		save it in ((path to desktop folder as text) & "Hello.txt")
	end tell
end tell

Hi

Here’s a slight variation on Stefan’s

tell application "TextEdit"
	activate
	make new document
	make new paragraph at beginning of document 1 with data "hello world"
end tell

Sounds good! Thanks :smiley: