On 5 Jul 2021, at 17:13, Francisco Hirsch wrote:

I have a TextFactory and an AppleScript.
I do the following:
Open pdf in Acrobat
Select all, copy, paste in a new BBEdit Window, process with the TextFactory, run the AppleScript clicking in BBEdit Scripts,
And everything works.
But if I include the AppleScript as the last line in the TextFactory:
It saves the original text copied from the pdf with it’s first line as it’s name. In other words, it’s as if the script (up to AppleScript line) did not work or the text was substituted in the AppleScript.
I’m baffled.

Each step in a text factory is intended to process the text that resulted from the previous step (or the file's contents, if it's the first step).
The user manual says:

===

• When you use the Run AppleScript Filter operation, your script should be written with an entry point named “ApplyTextTransform”. The input parameter to this entry point is a Unicode string containing the file’s contents. This entry point should return the file’s contents as a Unicode string (or something which can be directly coerced to one):

on ApplyTextTransform (fileData)
-- do something to fileData
return fileData -- or some reasonable facsimile thereof

====

Thus, text factories are not a way to chain together the execution of arbitrary AppleScripts, *unless* the scripts you're running explicitly process text provided as input to the text factory.

R.

--
Rich Siegel                                 Bare Bones Software, Inc.
<[email protected]>                      <https://www.barebones.com/>

Someday I'll look back on all this and laugh... until they sedate me.

--
This is the BBEdit Talk public discussion group. If you have a feature request or need 
technical support, please email "[email protected]" rather than posting here. 
Follow @bbedit on Twitter: <https://twitter.com/bbedit>
--- You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/FD65B274-A8E8-42BC-AE41-2EEEFD1B7ABE%40barebones.com.

Reply via email to