How to auto type words into a word proccessor.

I know this is “silly” but what is the applescript for it to run a word processor (such as TextEdit) and upon running, auto type given words in the script. I would love to know it!

It’s easier than you might think. First of all we have to “wake up” TextEdit:


tell application "TextEdit"
	activate

Then you can use Script Editor to check the TextEdit app’s dictionary and find that the application understands documents that have a text item. So you add:

	set the text of the front document to "This is the text I'm inserting"

Then we tell Applescript that we’re done talking to the TextEdit application.

end tell

So all together the script is:

tell application "TextEdit"
	activate
	set the text of the front document to "This is the text I'm inserting"
end tell

Thanks!:smiley: