Select text until full stop macro

I do a lot of tedious editing of text in my job and it would be great if there were a way to create a KM macro that would allow me to select all text in a given sentence.

The value in this for me would be that after I’ve edited part of a sentence, I wouldn’t then have to do a click, highlight, copy and then move to the next doc and paste it.

The problem is, I have no idea how to realise this. I suppose the best way of doing this would be to put the cursor in the body of the sentence and then active a macro that would do something like the following:

  1. Move cursor to start of sentence (move cursor left until a capital letter with a space before it is found)
  2. Highlight all text from sentence start until KM encounters either a “.”, “!” or “?”

Or, to simplify things, I could place the cursor at the start of the sentence, but I still have no idea how to make KM highlight all text if finds from the cursor up to and including standard end punctuation.

Can anyone here help?

Many thanks,

Will

UPDATE:

I just tried something after finding an option on the Wiki for “Execute actions until conditions met”.

I added this with the action being “press shift+alt+right arrow” (select text) until condition met.

Not knowing what condition to use, I tried typed text and included a full stop (.), but this didn’t work. KM highlighted everything in the doc and then tried to keep going, so I had to forcibly power down my laptop.

Am I at least on the right track with my thinking on this?

Many thanks,

Will

Stop the press!

The solution is simpler than I had imagined.

I just discovered after even more digging around that you can highlight a full sentence in Mac Word by pressing fn+F8 3 times.

I just created a simple repeat action shortcut and voila, my sentences are highlighted!

Might be worth noting that at least on my MacBook Pro if you don’t end this macro with key action “escape” (i.e. press the escape key), the highlighting remains engaged and will just keep including anything else on the page you happen to click on.

Will

1 Like

Hey @Will1,

When asking questions of this nature you need to always tell us what application you’re working in.

It makes a huge difference.

-Chris

Hi Chris,

Good point. Will do in future.

Will

Interesting solution, and one that I did not know about. Thanks for sharing.

The Mac offers a number of keyboard shortcuts for use with text that should work in most apps, although there are some (like MS Word) where they do not.


updated 2018-03-13 18:58 GMT-0500

  • Correct error equivocating "sentence" with "paragraph".
  • So my suggestion below does not really help in selecting just a sentence within a paragraph.

In most cases you can use these keystrokes to select an entire paragraph:

IF you are at the beginning of the paragraph:
⇧⌥↓

IF you are in the middle, or end, of a paragraph:
⌥↑
⇧⌥↓

IF you are at eh end of a paragraph:
⇧⌥↑

However, I have found three keystrokes that seem to always work:
as long as your cursor it at the beginning, end, or inside of a paragraph.

⌥↑
⇧⌥↓

So you could just use the last set of keystrokes, and put them in a KM Macro if you wish:

image

Thanks, JMichaelTX.

In most cases you can use these keystrokes to select an entire sentence, or what the macOS calls a paragraph:

IF you are at the beginning of the sentence:
⇧⌥↓

Thanks for listing these. I've got them in various forms in various macros (I do a lot of text editing), but I'm pretty sure a paragraph is a paragraph and a sentence is a sentence independent of the operating system a user is working with.

This is why I really needed a solution that selected only the one sentence from start to finish including closing punctuation rather than an entire paragraph, so finding the fn+F8 solution was a real stroke of luck.

Thus far, it's working great.

I added the "shift+left arrow" just to trim the extra space off at the end.

Best,

Will

You are absolutely right! I stand corrected.
I don't know what I was thinking. :frowning:

I have corrected my above post.