Re: Current paragraph # in quark text box
Re: Current paragraph # in quark text box
- Subject: Re: Current paragraph # in quark text box
- From: Hans Haesler <email@hidden>
- Date: Wed, 22 Aug 2001 17:38:15 +0200
On Wed, 22 Aug 2001, Jeff Horton wrote:
>
(...) if I have a piece of text selected in a box, how do I get
>
the paragraph # of were my selection is or if my cursor is on a
>
paragraph which # it is on.
Jeff,
this snippet expects some selected text or a blinking cursor.
The result is the number of the "current" paragraph of the story.
---
tell document 1 of application "QuarkXPress 4.11"
set insPoint to offset of selection
if insPoint = 0 then set insPoint to 1
tell current box
tell story 1
set paraNum to count paragraphs of (text from character 1 to character insPoint)
end tell
end tell
end tell
---
The test 'if insPoint = 0 then set insPoint to 1' is for the case when
the selection begins with the first character of the story or when
the cursor is blinking at the beginning. Else the result would be '0'.
Regards,
Hans
---
Hans Haesler <email@hidden>