tell application "TextEdit"
activate
make new document
end tell
This works fine for then keystroking text into the open document. But how do I make it open to so that the result is in plain text?
Thank you.
tell application "TextEdit"
activate
make new document
end tell
This works fine for then keystroking text into the open document. But how do I make it open to so that the result is in plain text?
Thank you.
This question has been answered numerous times.
TextEdit will not be able to create a plain text document when is specified “rich text” in its default mode settings. Either 1) specify “plain text” in the settings (manually), or 2) it is better - use Finder’s help for your task:
tell application "Finder"
set plainTextFile to make new file at desktop with properties {name:"Test.txt"}
end tell
tell application "TextEdit"
activate
open file (plainTextFile as text)
set plainTextDocument to front document
end tell
Thank you KniazidisR,
The second suggestion works nicely.