Dear Chris,

Thanks for the sample AppleScript. I have Sal Soghoian’s AppleScript 1-2-3 book as a reference, but it’s a little hard for me to wrap my head around this “human language” approach. However, I have implemented several short AppleScripts that I use with BetterTouchTool and my Stream Deck. In the mean time, I added the GREP command that Neil suggested, and “Boom!” IT WORKED!

At this point, I have a growing Text Factory that performs a variety of edits on manuscripts that I must edit.

Previously, I had been saving the GREP commands and using them in the Find and Replace window of BBEdit. However, it is much quicker to string them together in one Text Factory.

I appreciate the help!

Yours,

Mark

On 24 May 2023, at 18:42, Christopher Stone wrote:

On May 24, 2023, at 07:16, Mark Mayberry <markmaybe...@gmail.com> wrote:

However, I cannot figure out which Text Factory command is the equivalent of simply pressing BBEdit Text (Menu) >> Remove Line Breaks.

Hey Mark,

Surprisingly there isn't one...

You have to roll-your-own via a RegEx, AppleScript-filter, or text-filter.

I tend to turn to AppleScript for this sort of thing.

Note how you can mix and match AppleScript and Text Factories. In this instance it's easy enough to employ BBEdit's own 'remove line breaks' command.

Glad you're enjoying the Mac and BBEdit ( and Keyboard Maestro :).

-Chris


--------------------------------------------------------
# Auth: Christopher Stone <scriptmeis...@thestoneforge.com>
# dCre: 2023/05/24 18:30
# dMod: 2023/05/24 18:30
# Appl: BBEdit, System Events
# Task: Run a Specific Text Factory and ‘remove line breaks’ on the Front Document.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @BBEdit, @System_Events, @Text-Factory, @Remove_Line_Breaks
--------------------------------------------------------

set textFactoryFile to "~/Library/Application Support/BBEdit/Text Filters/Text Factories/TEST.textfactory" tell application "System Events" to set textFactoryFile to (POSIX path of disk item textFactoryFile)

tell application "BBEdit"
    set frontDoc to front text document
    apply text factory textFactoryFile to frontDoc
    tell frontDoc's text
        remove line breaks
    end tell
end tell

--------------------------------------------------------

--
This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "supp...@barebones.com" 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 bbedit+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/72A11FB2-C6FC-4D56-9431-B5DC03DCEBAE%40gmail.com.

--
This is the BBEdit Talk public discussion group. If you have a feature request or need 
technical support, please email "supp...@barebones.com" 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 bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/3E2D9D73-FB93-41A3-A795-89E494A870E8%40gmail.com.

Reply via email to