Use Applescript to go to the end of a text document

applescript

I have a very, very basic question: I have a little Applescript file that cleans up the html tags in a Textwrangler document. At the last stop, I'd like it to go to the end of document and add a line of text within an em html tag. I don't know applscript. To get this far I simply used the record-macro button in the script editor, but now I need to do something like "Goto EOF, write XYZ.

Any help?

Thanks!

Best Answer

This will work-- it operates on the current TextWrangler document. Change "XYZ" to whatever you want.

tell application "TextWrangler"
    set the_text to text of document 1
    set text of document 1 to the_text & return & "<em>XYZ</em>"
end tell