Horizontal Text Scaling in Quark 5

I have a script which is giving me a headache and would like some help is nayone knows.

The following script works fine on generic text boxes in Quark but for some reason it will not work on my document which has a named text box.

The code is as follows:

[tell application “QuarkXPress™”
activate
tell page 1 of document 1
tell story 1 of text box “boxAdNumber”
set horizontal scale to 100
end tell
set overflowTorF to get box overflows of text box “boxAdNumber”
if overflowTorF = true then
repeat until overflowTorF = false
tell story 1 of text box “boxAdNumber”
set horScale to horizontal scale as text
set origDelim to AppleScript’s text item delimiters --copy current delimiter to a variable
set AppleScript’s text item delimiters to “”
set horScaleCount to (count of characters of horScale)
set horScale to characters 1 thru (horScaleCount - 1) of horScale as string
set AppleScript’s text item delimiters to origDelim
set horScaleTxt to horScale as text
set horScale to (horScale - 5)
set horizontal scale to horScale
set overflowTorF to get box overflows of text box “boxAdNumber”
end tell
end repeat
end if
end tell
end tell]

It will only go through once and scales my text to 95%.

Then is stops and says
“QuarkXPress™ got an error: Can’t get box overflows of text box “boxAdNumber” of story 1 of text box “boxAdNumber” of page 1 of document 1.”

Anyone with any ideas?

Thanks

Hi :slight_smile:
In this instruction :

I think that the error comes because you already called the text box (tell story 1 of text box “boxAdNumber”), it is not necessary to call it again (redundant reference)…
:wink:

I have tried removing the duplicate line but when I do the condensing does not stop until it reaches the max (25%) and errors out again.

I have tried evrything I can think of with my limited knowledge but nothing seems to work. It does work fine if I set up a new textbox on the same documnet but for some reason it fails with the text box I have named as well as several others on the same document which are also named.

Could be a Quark 5 thing?

Hi :slight_smile:
Here a small suggestion (reailized with XPress 3):

tell application "QuarkXPress 3"
	activate
	tell page 1 of document 1
		tell text box "boxAdNumber"
			set horScale to 100
			set horizontal scale of story 1 of it to horScale
			repeat until (box overflows of it is false)
				set horScale to horScale - 5
				set horizontal scale of story 1 to horScale
			end repeat
		end tell
	end tell
end tell

:wink:

FANTASTIC!!

Thanks so much! You have solved my problem. I guess it does help to have a little experience behind you.

Thanks again.

Dean