nisus.com
https://www.nisus.com/forum/

Get Paragraph number
https://www.nisus.com/forum/viewtopic.php?f=17&t=3397
Page 1 of 1

Author:  credneb [ 2009-05-19 07:26:18 ]
Post subject:  Get Paragraph number

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 Previous Paragraph
Select Next Paragaph


I tried
Code:
Select Relative Paragraph 0


but this doesn't work.

Or, it could be done using
Code:
Select Paragraph (number)


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

Cliff Bender

Author:  Kino [ 2009-05-20 05:07:55 ]
Post subject:  Re: Get Paragraph number

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:
$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".

Author:  credneb [ 2009-05-20 05:23:32 ]
Post subject:  Re: Get Paragraph number

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.

Page 1 of 1 All times are UTC - 8 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/