Re: Selecting and deleting text in QuarkXPress
Re: Selecting and deleting text in QuarkXPress
- Subject: Re: Selecting and deleting text in QuarkXPress
- From: Hans Haesler <email@hidden>
- Date: Sat, 21 Jul 2001 22:16:04 +0200
On Sat, 21 Jul 2001, Shane Stanley wrote:
>
> Even the corrected version (theOffset + 2) will fail when the box has
>
> two or more columns, because counting lines in a multiple-columns box
>
> returns a wrong result.
>
>
You are right about my snippet, of course. (...)
Yeah. But my statement isn't quite right. When you _count_ lines, then
the result is correct. The problem is with asking for the _contents_
of the last line: you'll get the text of the last line but one (when the
box has two columns).
Try this: make a box with 2 columns of text, 10 lines each.
---
contents of line -1 --> text of last line but one
---
contents of line 11 --> ""
---
contents of line 21 --> error
---
>
(...) But I think you can get the correct line count -- or, more usefully,
>
offset of the last character -- if you ask nicely. Try this:
>
>
tell application "QuarkXPress 4.11"
>
tell document 1
>
tell text box 1
>
set theOffsets to offset of character -1 of every line
>
-- set lineCount to count items of theOffsets
>
delete text from character ((item -1 of theOffsets) + 2) to character -1
>
of story 1
>
if character -1 = return then delete character -1
>
end tell
>
end tell
>
end tell
I did try this: it's a brilliant solution! (but there must be more than
one line, or: add 'as list' to 'set theOffsets ........').
BTW, when the last character is 'next column' or 'next box' the overflow
symbol doesn't go away.
Nevertheless: this technique is useful for some _other_ things (because
I still don't know why I'd want to wipe out the overflow ;-).
Cheers,
Hans
---
Hans Haesler | email@hidden