Select Text ;Between Two Semi-Colons;

Normally, you have to type text and then select it after you wrote it before you can start taking actions (like copying or cutting the text). I would like to mark the start and end points for a selection as I'm writing!

I imagine that when I type text between two semi-colons, it will erase the semi colons and highlight ;the text that was between the semicolons;

Anybody have any ideas about how to do that?

To have any hope of this, I think you will at least have to know the application into which you are typing the text. I do not know how you would make this into some kind of "universal" macro.

Hey Robert,

Welcome to the forum!   :smile:

This kind of thing is doable but brittle.

What application(s) are you working in?

We don't normally have access to the underlying text engine of an editing field/panel, so we have to brute-force the UI (i.e. simulate keystrokes).

This macro requires an app that supports the macOS Find-Pasteboard (most do these days, but not all).

Select Typed-Text Between Prefix and Suffix Characters v1.00.kmmacros (7.2 KB)

Here's another method of doing the same thing that skips the delete characters step.

Select Typed-Text Between Prefix and Suffix Characters v2.00.kmmacros (8.3 KB)

These are fragile. If you have spelling correction on and something is corrected they'll break.

You can do the same thing without relying on the Find-Pasteboard by counting words or characters and then using Keyboard Maestro to move the cursor around to delete and select the desired characters.


I'll give this a try and get back to you. Thank you!

I'm mostly working in markdown text editors, like Obsidian.

Hmm it seems like it just cuts and pastes the text, but it doesn't highlight the selection

Did you try it in TextEdit?

Did the find-pasteboard get set?

There could be a timing issue.