Re: Adjusting height of textbox in Qxp
Re: Adjusting height of textbox in Qxp
- Subject: Re: Adjusting height of textbox in Qxp
- From: email@hidden
- Date: Fri, 26 Oct 2001 13:17:16 -0600
For users of 4.1 and above, you might want to check out the baseline
property for text. This can be used effectively for fitting a text box to
text.
The following script assumes an open document with a current text box that
is not linked. You will also want to save the current measurement units
before setting to points and restore the value when through.
tell application "QuarkXPress? 4.11"
activate
set theBox to current box
tell document 1
set horizontal measure to points
set vertical measure to points
tell current page
set x to bounds of theBox
set theBounds to coerce (x as points rectangle) to list
copy theBounds to {y0, x0, y1, x1}
set y0 to y0 as real
set x0 to x0 as real
set y1 to y1 as real
set x1 to x1 as real
if box overflows of theBox is true then--box currently overflows
set newBottom to y1 + 100--can use any number here
repeat while box overflows of theBox is true
set bounds of theBox to {y0, x0, newBottom, x1}
set newBottom to newBottom + 100--same number as above
end repeat
end if
--now that the box is larger than the text we will adjust the
bottom
set vertoffset to (baseline of character -2 of story 1 of theBox)
as real
--use character -2 just in case character -1 is a return
set theSize to (size of character -2 of story 1 of theBox) as real
set sizeAdjust to theSize / 2
--you might want to experiment with the division factor; this just gives
some space below the bottom line of text
set bounds of theBox to {y0, x0, (vertoffset + y0 + sizeAdjust),
x1}
end tell--current page
end tell--document 1
end tell--application
Of course, watch for line wraps. It is important that the box is not
linked. This will not work with linked boxes.
Shirley Hopkins
FaceSpan Support
AppleScripting QuarkXPress