185Extracting plain text from .seetext with Applescript
- Aug 20, 2008I've been happily coding with SubEtherEdit for years. I'm curious about the SubEther Text format, which I think would great for keeping track of changes over time.
I want to be able to instantly save a plain text version of the file in a relevant place to compile or run. I wrote the following applescript (full source is at http://mcalley.net.au/see/SaveAsPlainText.zip )
tell application "SubEthaEdit"set fileContents to plain text of the document of the front windowend tell
set commentMarker to "--" -- Lua comments
set firstLine to first paragraph of fileContents
set filePath to trim_line(firstLine, commentMarker, 0)
my write_to_file(fileContents, filePath, false)
...the first line of the Lua file contains the path and filename I want to save to (commented):
The result ends up like this:
...with every data byte preceded by zero. Is there a fix for this, or a simpler way that I haven't been able to find?
- Next post in topic >>