Get Paragraph number

Get help using and writing Nisus Writer Pro macros.
Post Reply
credneb
Posts: 156
Joined: 2007-03-28 07:30:34

Get Paragraph number

Post by credneb » 2009-05-19 07:26:18

For a variety of editing tools, I would like to select the paragraph where the insertion point is placed as a first step. This can be done using:

Code: Select all

Select Previous Paragraph
Select Next Paragaph
I tried

Code: Select all

Select Relative Paragraph 0
but this doesn't work.

Or, it could be done using

Code: Select all

Select Paragraph (number)
except I can't find any way for the macro to Get Paragraph number. Is there a way?

Cliff Bender

Kino
Posts: 400
Joined: 2008-05-17 04:02:32

Re: Get Paragraph number

Post by Kino » 2009-05-20 05:07:55

credneb wrote:I can't find any way for the macro to Get Paragraph number. Is there a way?
No. As of the version 1.2, there is not a reliable way to do so. You could try something like this:

Code: Select all

$sel = TextSelection.active
$i = 1
while Select Previous Paragraph
	$i += 1
end
Select Paragraph $i
exit $i
but the paragraph number returned by it differs from the one shown by NW Pro when there is a table and the code is obviously stupid if your purpose is just to "select the paragraph where the insertion point is placed".

credneb
Posts: 156
Joined: 2007-03-28 07:30:34

Re: Get Paragraph number

Post by credneb » 2009-05-20 05:23:32

Thanks for confirming that there is no way to get the paragraph number in a macro.

I guess that there is likewise no way to get the number of the other objects used by the various Select (object) [i]number[/i] commands. If you can't get the number, I can't see a use for these commands -- but I'm sure someone will.

Post Reply