Jag vet inte om jag får till det med encodingen om det inte handlar om .txt, men detta fungerar för mig annars:
tell application "TextWrangler"
set myOpenDocuments to documents
repeat with I from 1 to count myOpenDocuments
set myDocument to item I of myOpenDocuments
set myText to text of myDocument
set myFile to (file of myDocument as string)
close myDocument
tell application "Finder" to delete alias myFile
set myFileRef to open for access file myFile with write permission
set eof of myFileRef to 0
write myText to myFileRef as «class utf8» starting at eof
close access myFileRef
-- open myFile
end repeat
end tell
Det sparar nya versioner av alla filer öppna i TextWrangler och slänger de gamla i Trash.