Re: QuarkXPress: finding anchored boxes
Re: QuarkXPress: finding anchored boxes
- Subject: Re: QuarkXPress: finding anchored boxes
- From: Hans Haesler <email@hidden>
- Date: Thu, 22 Mar 2001 22:55:53 +0100
Michael,
>
> I hate to quell your enthusiasm ... ;-)
>
>
Ce est impossible!
<g> Well... I just imitated steve harley.
>
(...) Here is the output (ascii list) from a selection with PowerMathXT:
Thanks for the samples. Good to know.
>
> So, the best bet is still to create a new document, copy the selection
>
> in a new box, count the boxes and subtract 1.
>
>
Why does this help? I don't think it helps with my XT objects problem.
I take it that the deal is still to detect if a selection of text
contains selected boxes. So, given the several sources of ASCII 0
and ASCII 4 characters, the direct query of the selection is unreliable.
But when you create a new document and a new text box and copy the
selection to this box then the count of _generic_ boxes (generic,
because the box type of an anchored box could be 'text', 'picture',
'line', 'graphic' or 'XTension' -- and generic covers all of them)
is '1' if the selection doesn't contain any anchored boxes.
If the count is, e.g., '4' then there are 3 anchored boxes.
---
tell application "QuarkXPress 4.11"
activate
tell default document 1
set automatic text box to false
end tell
make document at beginning
tell document 1
make text box at beginning
end tell
copy selection of document 2 to before paragraph 1 of text box 1 of
document 1
tell document 1
set nBox to (count of generic box) - 1
end tell
display dialog "The selection contains:
" & nBox & " anchored boxes." buttons "OK" default button 1 with icon 1
close document 1 saving no
end tell
---
'Automatic text box' must be set to 'Off'. That's the reason for the
three lines after 'activate'. Then there should be a test of the nature
of the selection: Something like 'if class of selection = text then'
-- or a try wrapper around the copy command.
Regards,
Hans
---
Hans Haesler | email@hidden