Quark - line boxes - if statements

Hello

I wanting to move the position of lines on a Quark page and am stuck. Any help would be appreciated. Mac 10.4 / Quark 6.5.

If I have selected the line then the following runs fine and respositions the line.


tell application "QuarkXPress"
	tell current box
		set {x1, y1, x2, y2} to bounds as list
		set bounds to {x1, y1, 132, y2}
	end tell
end tell

However, I would like to be able to run through all the lines on a page, check their bounds and move them if necessary.

The following runs through all the lines and gets their bounds, but I can’t get the if statement to work.


tell application "QuarkXPress"
	tell document 1
		tell current page
			repeat with i from 1 to (count of line boxes)
					set {x1, y1, x2, y2} to (bounds of line box i) as list
					if (x2 as real) = (247) then
						set bounds of line box i to {x1, y1, 132, y2}
					end if
			end repeat
		end tell
	end tell
end tell

Thanks in advance

Sorry - the first post missed off the last chuck of script


Hello

I wanting to move the position of lines on a Quark page and am stuck. Any help would be appreciated. Mac 10.4 / Quark 6.5.

If I have selected the line then the following runs fine and respositions the line.


tell application "QuarkXPress"
	tell current box
		set {x1, y1, x2, y2} to bounds as list
		set bounds to {x1, y1, 132, y2}
	end tell
end tell

However, I would like to be able to run through all the lines on a page, check their bounds and move them if necessary. The following runs through all the lines and gets their bounds, but I can’t get the if statement to work.


tell application "QuarkXPress"
	tell document 1
		tell current page
			repeat with i from 1 to (count of line boxes)
					set {x1, y1, x2, y2} to (bounds of line box i) as list
					if (x2 as real) = (247) then
						set bounds of line box i to {x1, y1, 132, y2}
					end if
			end repeat
		end tell
	end tell
end tell

Thanks in advance

Try this:

tell application "QuarkXPress"
	tell front document
		repeat with x from 1 to (count of line boxes)
			tell line box x
				set {x1, y1, x2, y2} to bounds as list
				set bounds to {x1, y1, 132, y2}
			end tell
		end repeat
	end tell
end tell

Model: G5 Tower (not Intel) - Script Editor ver 2.1.1
Browser: Safari 419.3
Operating System: Mac OS X (10.4)

Thanks - that moves all the lines on the page.

However, what was missing from my original post was the “if statement”. I only want to move a line if one of the bounds is at a certain position. Unfortunately the script just seems to ignore the “if statement”. Any ideas? Thanks.

tell application "QuarkXPress"
	tell front document
		repeat with x from 1 to (count of line boxes)
			tell line box x
				set {x1, y1, x2, y2} to bounds as list
				if x2 is equal to "247 mm" then
					set bounds to {x1, y1, 132, y2}
				end if
			end tell
		end repeat
	end tell
end tell

Mark,

Probably an easier / better solution, but this may point you in the right direction:

In your code “x2” returns its class as “vertical measurement”. I coerced to a string…this works for me:

tell application "QuarkXPress"
	tell front document
		repeat with x from 1 to (count of line boxes)
			tell line box x
				set {x1, y1, x2, y2} to bounds as list
				set x2 to x2 as string
				if x2 contains "247" then
					set bounds to {x1, y1, 132, y2}
				end if
			end tell
		end repeat
	end tell
end tell

-N

Great - thanks