QUARK SCALE TYPE TO FIT

I am trying to scale a point size up so it ill fit the depth of a box. (Not with much luck). Each box is the same depth. Also is it possible to sscale down the point size if it overflows so that it will just fit in the box. I have posted the code I have done so far. Any help appreciated. Dave Walsh

set thelist to {"50% SOLD", "", "OPEN HOUSE SUN. 1-4", "IMMEDIATE POSSESSION"}
tell application "QuarkXPress™ 4.11"
   activate
   tell document 1
       tell page 1
           set theboxes to index of every generic box where name of it is "mayo" --"pic"
           repeat with x from 1 to the count of theboxes
               tell generic box (item x of theboxes)
                   set story 1 of it to item x of thelist
                   set justification of story 1 of it to centered
               set font of story 1 of it to "CXB Futura CondExtraBold"
                   set leading of story 1 of it to 14
                   set color of story 1 to "red"
                   set size of story 1 of it to 14
                   set horizontal scale of story 1 of it to 95
               end tell
           end repeat
           repeat with x from 1 to the count of theboxes
       tell generic box x
                   set paraheight to height of paragraph 1 of story 1 as list
                   set paraheight to paraheight as real
                   set boxheight to height of bounds as list
                   set boxheight to boxheight as real
           repeat until paraheight is equal to boxheight
                       set TxtScaleOrig to size of paragraph 1 of story 1 as list 
                       set TxtScale to TxtScaleOrig as real 
                   set TxtScale to TxtScale + 5
                       set size of paragraph 1 of story 1 to TxtScale
                       set leading of paragraph 1 of story 1 to TxtScale
                   end repeat
               end tell
           end repeat
       end tell
   end tell
end tell

I have done this myself just recently. My solution was to scale it up 1 point at a time - checking to see if the box overflows after each pass thru the repeat loop.


set boxOverflows to false
repeat until boxOverflows is true
set size of theParagraph to size +1
if overflow of text box 1 is true then set boxOverflows to true
end repeat

HTH -john