Re: Anchored Picture Box In Quark
Re: Anchored Picture Box In Quark
- Subject: Re: Anchored Picture Box In Quark
- From: Hans Haesler <email@hidden>
- Date: Mon, 5 Nov 2001 01:38:37 +0100
On Sun, 04 Nov 2001, Arthur J Knapp wrote:
>
Great stuff !!!
Thanks. :-)
To be honest: some seven months ago I needed a fast handler
for converting a string to ASCII numbers. I remembered having
seen one posted to one of the lists by... Arthur J Knapp.
Since your message had been stored on my machine at work
I tried to reconstruct the handler, here at home -- and this
is the same code I used in my reply to Jay.
>
Hans, you once posted something about using Quark's character
>
delimiters to delete or obtain textual elements. Could the same
>
thing be done to delete all anchored boxes from a text flow?
Well... I'm not sure which message you're refering to. Maybe the
one about using a S&R handler for replacing style sheet names.
To delete all anchored boxes, the script must build a list with
the offsets of all ASCII character 4. The value is added to the
list after testing the next character (this is necessary to
exclude the second 4 of ... 4, 0, 4 ...).
Then the script goes backwards through the list and deletes
the characters:
---
property AsciiChars : run script "set charList to {}
repeat with i from 0 to 255
set end of charList to ASCII character i
end repeat
return charList as string"
tell document 1 of application "QuarkXPress 4.11"
activate
set aStr to text of selection
end tell
set offList to {}
repeat with i from 1 to count aStr
if ((offset of (character i of aStr) in AsciiChars) - 1) = 4 then
if ((offset of (character (i + 1) of aStr) in AsciiChars) - 1) is less than 10 then
set end of offList to i
end if
end if
end repeat
repeat with x in reverse of offList
tell document 1 of application "QuarkXPress 4.11"
tell selection
delete (text from character x to character (x + 2))
end tell
end tell
end repeat
---
This works, but the "phantoms" of the anchored boxes can't be
deleted, i.e. when you move the text box around a little bit
then the rectangles, where the anchored boxes have been, are not
refreshed. Changing the view scale helps, but only temporarily.
Another problem: ASCII character 4 is not reserved for anchored
boxes. There are XTensions which use it as well, e.g. "NotesXT"
which generates 59 invisible characters, including, twice an
ASCII character 4.
Best regards,
Hans
---
Hans Haesler <email@hidden>