Page 1 of 1

Get Paragraph number

Posted: 2009-05-19 07:26:18
by credneb
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

Re: Get Paragraph number

Posted: 2009-05-20 05:07:55
by Kino
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".

Re: Get Paragraph number

Posted: 2009-05-20 05:23:32
by credneb
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.