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: Sat, 3 Nov 2001 23:57:46 +0100
On Sat, 3 Nov 2001, Jay Young wrote:
>
Anybody have any idea's how to delete an anchored picture box in Quark
>
using Applescript?
Jay,
if you select your example and ask for the ASCII numbers...
---
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"
set aStr to text of selection
end tell
set numList to {}
repeat with i from 1 to count aStr
set end of numList to (offset of (character i of aStr) in AsciiChars) - 1
end repeat
numList
---
... then you'll see that the anchored box is represented by
three characters: {..., 4, 0, 1, ...}.
A second box would be... 4, 0, 2. A third... 4, 0, 3 and
so on until... 4, 0, 255. Then... 4, 1, 1... 4, 1, 2.
To delete an anchored box you must delete all three
characters, else you'll get a crash.
This should get you started: type some text, anchor a box
in the middle of them, select everything and run the
following script.
---
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
repeat with i from 1 to count aStr
set actChar to (offset of (character i of aStr) in AsciiChars) - 1
if actChar = 4 then
tell document 1 of application "QuarkXPress 4.11"
tell selection
delete (text from character i to character (i + 2))
exit repeat
end tell
end tell
end if
end repeat
---
Now, if you'd like to delete more than one box, then you should
rewrite this script to work backwards. But then the problem
would be the box which is represented by... 4, 0, 4 ...
Regards,
Hans
---
Hans Haesler <email@hidden>