it requires the contents of the whole file. This means that I unfortunately cannot (as far as I know) use a regular text filter.
The idea is to save the content of the active text document into a temporary location (to make sure it also supports unsaved files)
To my surprise, the hardest part seems to be to actually store a copy of the contents of the text document into a temporary file... All my attempts so far failed.
Then I tried to write the "contents of text document 1" to a file, like this:
However, the result has LF (mac) line ends, instead of CR (unix) lineends as the original file.
BTW, is there *any* serious documentation on the BBEdit AppleScript suite?
On Feb 03, 2016, at 11:28, Max Horn <m...@quendi.de> wrote:it requires the contents of the whole file. This means that I unfortunately cannot (as far as I know) use a regular text filter.______________________________________________________________________Hey Max,You probably can use a regular text filter by putting your get-text AppleScript in with `osascript`.
The idea is to save the content of the active text document into a temporary location (to make sure it also supports unsaved files)That doesn't make obvious sense, unless you're wanting to save so you can read it back from disk.
To my surprise, the hardest part seems to be to actually store a copy of the contents of the text document into a temporary file... All my attempts so far failed.Simple. ( When you know AppleScript and have spent many hours scripting BBEdit. :)-------------------------------------------------------------------------------------------tell application "BBEdit"tell front text documentset docName to its nameset _text to its textend tellset tempFilePath to (path to temporary items as text) & docNameset newDoc to make new document with properties {text:_text} initial save location tempFilePathsave newDocend tell-------------------------------------------------------------------------------------------
You probably can use a regular text filter by putting your get-text AppleScript in with `osascript`.
Note sure what you mean with that. Perhaps this is a misunderstanding? To clarify, I would prefer *not* to use AppleScript, almost any other language is preferable to me.
… While the text transformation I have implented is transforms only the currently selected text, to work correctly it *needs* to know the complete content of the file to work correctly.
I want to store the content to a temporary file, so that my actual filter tool (written in Python, and invoking various command line tools) can process the full content of the file …