Quark - width of multiple selected text boxes

Hi there,

does anyone know how I can get the complete width of multiple selected text boxes in Quark XPress?
I need this to create a new box wich has the width and height wich all selected boxes have together.

Imion

It’s just “bounds of current box” when you have multiple selections.

Here is a script I made to take the width and height of everything you have selected and change your page size to that size (it assumes your objects are at x:0 y:0 already). I’m sure you can pull out what you need from here. I always have trouble getting measurements from Quark in that they come out with a huge number of decimal places. That’s why there is the weird code to strip it down to three decimal places. There’s probably a better way to do it…

tell application "QuarkXPress"
	tell front document
		set horizontal measure to inches
		set vertical measure to inches
		set AppleScript's text item delimiters to "."
		try --This is a test to make sure you actually have something selelcted
			set testing to properties of current box
		on error
			return
		end try
		
		set BoxWidthTemp to ((get width of bounds of current box) as real) as string
		set BWCount to the count of characters in the second text item of BoxWidthTemp
		if BWCount is greater than 3 then
			set BWCount to 3
		end if
		set BoxWidth to ((the first text item of BoxWidthTemp as string) & "." & (text 1 thru BWCount of the second text item of BoxWidthTemp as string)) as number
		
		set BoxHeightTemp to ((get height of bounds of current box) as real) as string
		set BHCount to the count of characters in the second text item of BoxHeightTemp
		if BHCount is greater than 3 then
			set BHCount to 3
		end if
		set BoxHeight to ((the first text item of BoxHeightTemp as string) & "." & (text 1 thru BHCount of the second text item of BoxHeightTemp as string)) as number
		set page width to BoxWidth
		set page height to BoxHeight
	end tell
end tell

Browser: Safari 419.3
Operating System: Mac OS X (10.4)

Thank you for your answer,

you helped me so much!

But I have one more question.

This is my script now:


tell application "QuarkXPress Passport"
	tell front document
		try --This is a test to make sure you actually have something selelcted
			set testing to properties of current box
		on error
			return
		end try
		
		-- Breite un d Höhe der ausgewählten Rahmen ermitteln		
		set BoxWidth to ((get width of bounds of current box) as real) as string
		set BoxHeight to ((get height of bounds of current box) as real) as string
		
		-- Den neuen Rahmen erstellen
		tell current page
			make new text box with properties {bounds:{"0 mm", "0 mm", BoxHeight, BoxWidth}, runaround:none runaround, vertical justification:centered, color:null} at beginning
		end tell
		
		
	end tell
end tell

And it works fine. But I need to get the x and y measure from the very first text box. I thougt I can get it by using


		set theSelected to every text box whose selected is true
		
		
		set theBox to item 1 of theSelected
		
		tell theBox
			set BoxA to ((item 1 of theBox) as point units) as real
			set BoxB to ((item 2 of theBox) as point units) as real
		end tell

From another Script, but this dosn’t work. May you help me one more time?

I get an error when trying to run this script:
It says that the new box could not be created, but not why.


tell application "QuarkXPress Passport"
	tell front document
		
		try --This is a test to make sure you actually have something selelcted
			set testing to properties of current box
		on error
			return
		end try
		
		
				
		set BoxWidth to ((get width of bounds of current box) as real) as string
		set BoxHeight to ((get height of bounds of current box) as real) as string
		set BoxLeft to ((get left of bounds of current box) as real) as string
		set BoxTop to ((get top of bounds of current box) as real) as string
		
		
		tell current page
			try
				set NewFrame to make new picture box with properties {bounds:{BoxTop, BoxLeft, BoxHeight, BoxWidth}, runaround:none runaround, vertical justification:centered, color:null}
			on error
				display dialog "No Box created"
			end try
		end tell
		
		
	end tell
end tell

What could be wrong?

Imion, give this a try. Not sure where you picked up “vertical justification:centered” from? but it isn’t a property of a picture box.

tell application "QuarkXPress"
	activate
	if not (exists document 1) then error "No document is open."
	if not (exists current box) or box type of current box is not group box type then error "No group of boxes is selected"
	set selectedBoxes to object reference of current box
	set groupBounds to bounds of selectedBoxes as list
	tell document 1
		tell current page
			try
				set NewFrame to make new picture box at beginning with properties ¬
					{bounds:groupBounds, runaround:none, color:null}
			on error
				display dialog "No Box created"
			end try
		end tell
	end tell
end tell

there was a “runaround” too many I hadn’t spotted.

You are right. I had taken this line from a script where a text box was handled and have forgotten to delete this part.

Thank you very much for your help.