Script to look at text boxes in Quark errors out

Okay, I thought this was an easy one. Perhaps someone can point out my problem? This script looks at a Quark document, examines all text boxes and deletes the empty ones. It works okay but eventually errors out. I’m sure somebody must have written something similar, but I couldn’t find it. Thanks.


tell application "QuarkXPress"
	activate
	tell document 1
		repeat with T from 1 to (count of every text box)
			tell text box T
				set P to (every paragraph)
				if P = {} then delete
			end tell
		end repeat
	end tell
end tell

You’re right, it is an easy one:

tell application "QuarkXPress"
    if (exists of document 1) then delete (text boxes of document 1 whose contents of story 1 of it = "")
end tell

Jon

Badda-boom badda-bing! It worked!

I was way off on that one. This is my first time trying to script Quark. Excel is my game.

Thanks a million.