On Aug 14, 2021, at 20:17, e2o <[email protected]> wrote: > > Oh, excellent stuff - thank you both. Now as I try to figure out how I'll > script this, my initial ideas are fairly cumbersome. Yeah, I could bring up > the Find dialog, paste in the search criteria and [ ⌘ ⌥ ⌃ G ], but is there > a repeatable way using a named saved search or something?
I'm probably missing something here :-) but why is it important that you be able to script this action: do you just want to be able to perform this operation on demand whenever you open a suitable document, or do you want to integrate it into a larger external workflow? Again, a concrete example with steps would be extremely helpful. :-) If however a search & replace of the form you describe below: > find (myInitialLines)(thenEverythingToTheEnd) and replace with \1\2\1 *would* do the job then you need only create a text factory which contains a Replace All action with the specified Find and Replace patterns, then save that factory as a _text filter_ and you can assign it a key shortcut to invoke against the current document at any time. > I was hoping a Text Factory would have something as simple as a Find and Copy > command, but it seems to insist on a Replace. For reference, text factories are designed to _transform_ whatever text you apply them to: whether the contents of the current document when run as a _text filter_, or a batch of files when run globally as a _script_, and the advantage of using a text factory is that you can easily define and apply any desired set of actions (i.e. text transformations) with no need for scripting. > I guess I could find (myInitialLines)(thenEverythingToTheEnd) and replace > with \1\2\1 - which would result in copying my initial non-blank lines to the > end of the document - but that seems kinda kludgy. If that is what you wish to accomplish then I don't see anything at all kludgy about the solution; it's an entirely valid transform. Regards, Patrick Woolsey == Bare Bones Software, Inc. <https://www.barebones.com/> -- 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/A449E6D3-91C3-460F-9781-C0F9BD783D1B%40barebones.com.
