Use Keyboard Maestro (KM) to Automate BBEdit Menu Steps

72 views
Skip to first unread message

Mark Mayberry

unread,
May 22, 2023, 10:09:55 AM5/22/23
to BBEdit Talk

I am attempting to set up create a macro that would automate the process of cleaning up a block of text as I import it into BBEdit. I have successfully created a macro that selects the Text Menu in BBEdit to (1) Straighten Quotes, (2) Strip Trailing Whitespace, and (3) Normalize Line Endings. These steps are easy.

However, I cannot get KM to complete the following step:

BBEdit Master Menu: Select "Text"
BBEdit Text Menu: Select "Canonize"

"Canonize" performs changes on a document using a list of transformations from a file, which in my case is named, "~/Documents/BBEdit/BBEdit-Canonize-Bible-Misc.txt". The sub-menu says, "Use transformations from file:" and shows a windows containing a highlighted link to the following file: "~/Documents/BBEdit/BBEdit-Canonize-Bible-Misc.txt". The "Apply" Button is also highlighted in Blue, meaning that if I performed this step manually, hitting "Apply" would run the canonization process.

KM stops processing the macro at this point. If I highlight this specific step in the macro, right click and choose "Try Action," it executes properly. However, my question is "How can I get KM to perform this step automatically?"

Thanks for any guidance you can offer!

Yours,  Mark


Screenshot_2023-05-22 08.49.48_Vi9PIT.png
BBEdit Verse Import.kmmacros

Rich Siegel

unread,
May 22, 2023, 10:10:42 AM5/22/23
to BBEdit Talk
On 22 May 2023, at 10:04, Mark Mayberry wrote:

> I am attempting to set up create a macro that would automate the process of
> cleaning up a block of text as I import it into BBEdit. I have successfully
> created a macro that selects the Text Menu in BBEdit to (1) Straighten
> Quotes, (2) Strip Trailing Whitespace, and (3) Normalize Line Endings.
> These steps are easy.
> [...]

I don't know anything about Keyboard Maestro, but have you considered using a Text Factory for this?

Start with File => New => Text Factory and go from there.

R.

Mark Mayberry

unread,
May 22, 2023, 11:07:10 AM5/22/23
to BBEdit Talk
Dear Rich,

Thanks! I have not yet explored “Text Factory” but will give it a whirl. Since we are talking about an internal BBEdit set of keystrokes, it might be better to stay “in house.”

Yours,

Mark
> --
> This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "sup...@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+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/1357698D-18C5-41AE-8029-46890A86EB02%40barebones.com.

Kaveh Bazargan

unread,
May 22, 2023, 11:21:05 AM5/22/23
to bbe...@googlegroups.com
Hi Mark

I think Text Factory is indeed what you need. it is not based on keystrokes, but BBEdit actions that are carried out one after another. Here is a glimpse of one I made to convert VCF to CSV. I am using just regular expressions, but you can use any BBEdit command.

Regards
Kaveh
image.png



--
Kaveh Bazargan PhD
Director
Accelerating the Communication of Research
  https://rivervalley.io/gigabyte-wins-the-alpsp-scholarly-publishing-innovation-award-using-river-valleys-publishing-technology/

Mark Mayberry

unread,
May 22, 2023, 11:25:44 AM5/22/23
to bbe...@googlegroups.com

Dear Kaveh,

YES! Thank you! I tried the same procedure in Text Factory and it worked PERFECTLY! Quick question: Is it possible to set up a shortcut keystroke in BBEdit that (when pressed) will run my newly created TextFactory?

Yours,

Mark

Kaveh Bazargan

unread,
May 22, 2023, 11:33:00 AM5/22/23
to bbe...@googlegroups.com
Should be easy to do as it is just one keystroke, but don't know off hand. Sure others will suggest something!

Regards
Kaveh

Fletcher Sandbeck

unread,
May 22, 2023, 11:37:09 AM5/22/23
to bbe...@googlegroups.com
If you add the text factory as a Text Filter then you can assign it a keyboard shortcut. Put it in ~/Library/Application Support/BBEdit/Text Filters/ and then you can run it from the Text > Text Filters menu or assign a keyboard shortcut in Settings... on the Menus & Shortcuts tab.

h/t Christopher Stone.

[fletcher]

Mark Mayberry

unread,
May 22, 2023, 12:13:59 PM5/22/23
to bbe...@googlegroups.com

Dear Christopher,

Thank you! I followed your instructions and it works like a charm!

Yours,

Mark

Reply all
Reply to author
Forward
0 new messages