Macro to Delete Unitl End of Sentence

Get help using and writing Nisus Writer Pro macros.
Post Reply
Posts: 30
Joined: 2007-07-30 12:06:49

Macro to Delete Unitl End of Sentence

Post by lawrencegoodman » 2007-10-19 08:25:46

Another macro request:
I need a macro that will deletete from the cursor to the end of the sentence (i.e. the period).

Any advice?


User avatar
Official Nisus Person
Posts: 4485
Joined: 2002-07-11 17:14:10
Location: San Diego, CA

Post by martin » 2007-10-19 14:25:03

This should do what you're looking for:

Code: Select all

$deleteStart = Selection Location
$deleteLen = 0

# find the end of the current sentence
Find '($|\.(?![0-9])|[!?]+)[ \t]*', "E"
$selStart = Selection Location
$selLen = Selection Length
Begin Perl
$deleteLen = $selStart - $deleteStart;

# Select the sentence and delete it
Set Selection $deleteStart, $deleteLen
We also have some other sentence navigation macros in our macro repository.

Post Reply