use scripting additions
use framework "Foundation"
use framework "AppKit"
on open fileList
repeat with aFile in fileList
set thePath to POSIX path of aFile
-- make NSURL
set anNSURL to (current application's class "NSURL"'s fileURLWithPath:thePath)
-- read document as rich text
set {theAttributedText, theError} to (current application's NSAttributedString's alloc()'s initWithURL:anNSURL documentAttributes:(reference))
if theAttributedText = missing value then
display dialog "Error reading '" & (anNSURL's lastPathComponent() as text) & ": " & (theError's localizedDescription() as text) buttons {"OK"}
else
-- get just text
set theString to theAttributedText's |string|()
-- make encoded data
set theData to (theString's dataUsingEncoding:(current application's NSUTF8StringEncoding))
-- save data to new file
set newURL to (anNSURL's URLByDeletingPathExtension()'s URLByAppendingPathExtension:"txt")
(theData's writeToURL:newURL atomically:true)
end if
end repeat
end open
Under Mavericks you'd need to save it as a handler in a script library, and call it from there.
Using UTF8 is likely to be more reliable than Latin 1 or WindowsCP1252.