I have looked everywhere on the forums:-
i am trying to write a script which opens a text file, clears the contents of the text file and then pastes a new piece of text. This script merely appends the text file.
tell application "TextEdit"
launch
set f to open for access (p2d as text) & fName with write permission
try
set t to read f
set t to ""
on error
set t to "why is that?"
end try
write theText & (ASCII character 59) as string to f
close access f
end tell