Dynamic Text Factory ?

76 views
Skip to first unread message

Robert Schwalbe

unread,
Aug 13, 2024, 3:14:22 PM8/13/24
to bbe...@googlegroups.com
I hope this is not blatantly obvious because I certainly did put in
some time to
come up with an answer by myself.

Can a text factory work on a dynamic set of files?

I have a text factory that performs a half dozen or so operations. In
my case all targeted
files would be open, I then open the text factory, select Choose,
check "Open Editing
Windows" and hit the Run button. Bingo Bango done!

What I would like to do is still have my targeted files open, but
then just run a text factory
(preferably sans any UI) and the text factory knows to operate on the
"Open Editing Windows"
just as described above but without any of the interacting.

Here's to some hopeful wishing!

On the other hand, a pessimist is never disappointed.

jj

unread,
Aug 14, 2024, 4:05:38 AM8/14/24
to BBEdit Talk
Hi Robert,

You could do this with a snippet of AppleScript like so:

try

tell application "BBEdit"

-- Replace <user> and <my_beautiful> with your user's name and textfactory's name.

set vTextFactory to POSIX file "/Users/<user>/Library/Application Support/BBEdit/Text Factories/<my_beautiful>.textfactory"

repeat with vDocument in its text documents as list

apply text factory vTextFactory to vDocument saving no

end repeat

end tell

on error aMessage

display alert aMessage

end try


HTH,

Jean Jourdain

Robert Schwalbe

unread,
Aug 14, 2024, 2:28:05 PM8/14/24
to bbe...@googlegroups.com
>>On Tuesday, August 13, 2024 at 9:14:22?PM UTC+2 Robert Schwalbe wrote:
>>
>>I hope this is not blatantly obvious because I certainly did put in
>>some time to
>>come up with an answer by myself.
>>
>>Can a text factory work on a dynamic set of files?
>>
>>I have a text factory that performs a half dozen or so operations. In
>>my case all targeted
>>files would be open, I then open the text factory, select Choose,
>>check "Open Editing
>>Windows" and hit the Run button. Bingo Bango done!
>>
>>What I would like to do is still have my targeted files open, but
>>then just run a text factory
>>(preferably sans any UI) and the text factory knows to operate on the
>>"Open Editing Windows"
>>just as described above but without any of the interacting.
>>
>>Here's to some hopeful wishing!
>>
>>On the other hand, a pessimist is never disappointed.
>>
>You could do this with a snippet of AppleScript like so:
>
>try
>
> tell application "BBEdit"
>
> -- Replace <user> and <my_beautiful> with your user's
>name and textfactory's name.
>
> set vTextFactory to POSIX file
>"/Users/<user>/Library/Application Support/BBEdit/Text
>Factories/<my_beautiful>.textfactory"
>
> repeat with vDocument in its text documents as list
>
> apply text factory vTextFactory to vDocument saving no
>
> end repeat
>
> end tell
>
>on error aMessage
>
> display alert aMessage
>
>end try

Thank you Jean!

You gave me the confidence to give this a try. Something like this
did actually cross
my mind - no idea of the syntax though. On top of the inherent self
doubt I just thought
I was so far out in the tulies that there was just no way this was
the way to go.

Absolutely no slight to BBEdit (at all) because I did not know if I
was an edge case or not.
I could care less what the solution ended up being. The fact that
there *is* a solution just
reaffirms the depth of BBEdit and a welcoming community.

Reply all
Reply to author
Forward
0 new messages