Is there a more perfect solution for that:
tell application "TextEdit"
set Text1 to "my text and so on…"
activate
set theDoc to make new document
tell application "System Events" to tell process "TextEdit"
keystroke "t" using {shift down, command down}
end tell
delay 1
tell theDoc
set text of theDoc to Text1
end tell
end tell
for example by using properties:
set Text1 to "my text and so on…"
tell application "TextEdit"activate
set theDoc to make new document with properties {text:Text1, Content:text / plain} --doesnt work
tell theDoc -alternative way
set text of theDoc as plain text
end tell
end tell
You can read the TextEdit defaults like this:
Output
The parameter
RichText = 0
means it will create new documents in "Plain Text" format.You can change the default to "Rich Text" with:
You can change the default to "Plain Text" with: