Hello,

has anybody an idea how I can check if one box is behind (before) another ?

For boxes of the same type I can use the index, but not for boxes of different

types.

Any suggestions ?

Best Regards

Thomas

Hello,

has anybody an idea how I can check if one box is behind (before) another ?

For boxes of the same type I can use the index, but not for boxes of different

types.

Any suggestions ?

Best Regards

Thomas

Try using references to “generic boxes”.

Jon

If you are just comparing if one box is in front of another in layer order, then refer to them as generic boxes and compare the index of each box. The box with the lower value is in front of the other. If you want to know if two boxes are intersecting, then try the following:

```
on CheckIntersect(Bounds1, Bounds2)
set x1 to (item 2 of Bounds1) as real
set y1 to (item 1 of Bounds1) as real
set x2 to (item 4 of Bounds1) as real
set y2 to (item 3 of Bounds1) as real
set p1 to (item 2 of Bounds2) as real
set q1 to (item 1 of Bounds2) as real
set p2 to (item 4 of Bounds2) as real
set q2 to (item 3 of Bounds2) as real
if p1 > x1 and p1 < x2 and q1 > y1 and q1 < y2 then display dialog "Intersecting"
if p1 > x1 and p1 < x2 and q2 > y1 and q2 < y2 then display dialog "Intersecting"
if p2 > x1 and p2 < x2 and q1 > y1 and q1 < y2 then display dialog "Intersecting"
if p2 > x1 and p2 < x2 and q2 > y1 and q2 < y2 then display dialog "Intersecting"
end CheckIntersect
tell application "QuarkXPress™ 4.11"
tell document 1
set Bounds2 to bounds of generic box 1 as list
set Bounds1 to bounds of generic box 2 as list
end tell
end tell
CheckIntersect(Bounds1, Bounds2)
```

It needs tweeking, I put it together rather fast. but this should work for as a test for two intersecting rectangles on the same page.