Pages -- Select Sentence [Example]

Use Case

  • Select a Sentence in Apple Pages app that can contain periods
    • This could easily be modified for use with any app that supports the Finder Pasteboard
  • Text Cursor May Now be anywhere within the target Sentence (start, middle, or end).
  • Sentence may end in any of the common punctuation marks .?!
  • See the Assumptons in the below Release Notes for the definition of a Sentence.
  • Limitations:
    1. Note: This Macro is designed only for the English language and may or may not work in other languages.
    2. Macro will yield a false positive IF an abbreviation is immediately followed by a capital word that is NOT the start of a new sentence, as in:
      "abbrev. KM"

This Macro was built in response to:
Select a sentence in Pages

UPDATED: 2019-02-17 21:19 GMT-6

Output Example


MACRO:   Pages -- Select Sentence With Cursor Within Sentence [Example]

~~~ VER: 2.0    2019-02-17 ~~~

  • Text Cursor may now be located anywhere within (start, middle, end) of Target Sentence.


Pages -- Select Sentence With Cursor Within Sentence [Example].kmmacros (24 KB)
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.




  • Select Sentence in Pages app
    • Uses RegEx and Find Pasteboard
    • Text Cursor May be at Start, Middle, or End of Sentence


  1. KM 8.2+
  2. macOS 10.11.6 (El Capitan) or later

NOTICE: This macro/script is just an Example

  • It has had very limited testing.
  • You need to test further before using in a production environment.
  • It does not have extensive error checking/handling.
  • It may not be complete. It is provided as an example to show you one approach to solving a problem.

How To Use

  1. Open Apple Pages with a document of interest.
  2. Position Text Cursor at the Start, Middle, or End of a Sentence you want to select.
  3. Trigger this macro.
    • It will then use RegEx to identify the Sentence within the remainder of the paragraph. See Assumptions below for the definition of a Sentence.
    • Use the Find Pasteboard to select that Sentence.


  • Carefully review the Release Notes and the Macro Actions
    • Make sure you understand what the Macro will do.
    • You are responsible for running the Macro, not me. ??
  1. Assign a Trigger to this maro..
  2. Move this macro to a Macro Group that is only Active when you need this Macro. Most likely this is for the Pages app.
  3. ENABLE this Macro.


  1. That the user has positioned the text cursor within (Start, Middle, End) of the Sentence.
  2. The Sentence ENDS with one of the following punchuation:
    • Followed by another Sentence that identified by the following after the END of the first Sentence:
      • One or more horizontal whitespace characters
      • A Capital letter
      • The END of the string

TAGS: @Pages @RegEx @Find @Pasteboard @Select


  • Any Action in magenta color is designed to be changed by end-user


  • To facilitate the reading, customizing, and maintenance of this macro,
    key Actions are colored as follows:
  • GREEN -- Key Comments designed to highlight main sections of macro
  • MAGENTA -- Actions designed to be customized by user
  • YELLOW -- Primary Actions (usually the main purpose of the macro)
  • ORANGE -- Actions that permanently destroy Variables or Clipboards,
    OR IF/THEN and PAUSE Actions


  • While I have given this limited testing, and to the best of my knowledge will do no harm, I cannot guarantee it.
  • If you have any doubts or questions:
    • Ask first
    • Turn on the KM Debugger from the KM Status Menu, and step through the macro, making sure you understand what it is doing with each Action.



Just updated.