I am trying to catch text that overflows a text box, and then reduce the point size of the text until it fits in the text box. I can get this to work easily by scaling the text with the horizontal scale option. Although this is not really a good way of doing it. The way I really want to do it is for all the text to be scalled in proportion to its original point size. The only way I can currently get this to work, is to specify a point size, and then scale all text to that size. The script I am currently using with the scaling horizontal is shown below. The other problem is, that there may be more than one box with overflow issues, and I am attaching a label to the boxes I want to affect, so it may need to repeat the routine as many times are the issue exists.
tell application "InDesign CS"
set myDoc to active document
tell myDoc
set counts to all page items of text frame "price"
set onetwothree to number of counts
set number_of_frame to onetwothree
tell myDoc
if onetwothree = 0 then
set number_of_frame to 1
end if
display dialog number_of_frame
repeat number_of_frame times
set theFrame to item number_of_frame of text frame "price"
set theStory to parent story of theFrame
--set number_of_frame to number_of_frame - 1
try
set spill to overflows of theFrame
set Oscale to horizontal scale of theStory as integer
repeat until spill is false
set Oscale to Oscale - 5
tell item number_of_frame of text frame "price"
set horizontal scale of theStory to Oscale
set vertical scale of theStory to Oscale
set spill to overflows of theFrame
end tell
end repeat
end try
set number_of_frame to number_of_frame - 1
end repeat
end tell
end tell
end tell
Any help is greatly appreciated. Also any more information can be provided if needed.