I want to increase QuarkXPress 11 page by 1 inch in height, please

G’day Scripters.

I’ve downloaded the Applescript guide for QuarkXPress 11, but it’s useless for what I want to do.

Fetching the page height of document frontmost returns, for example, 11" (that’s an ‘eleven’ with an inches sign). It cannot be co-erced to an integer or text.

I want to add two text boxes in a space an inch above the page size, and increase the page size to cover them. The pages are not always 11" to start with. The extra printing space is not a problem, I just have to ensure the two new text boxes are not covering any text or images on the page.

Can anyone guide me on how to determine a page height, and add one inch to it, please?

Using Yosemite.

Regards

Santa

Model: Late 2014 retina i7, Yosemite
AppleScript: 2.4
Browser: Safari 600.2.5
Operating System: Mac OS X (10.10)

I should also add that I want to actually print these extra text boxes. ATM I’m setting them above the top margin position, and reducing the top margin to 0, but they still won’t print.

Any reason why, please?


property theLargePagePrinter : "Large Page Printer"

set TempAttachmentName to "(20150722121212Z)"
set PreserveFileName to "This is a test"

tell application "QuarkXPress"
	say version > "11.0.0" and version < "12.0"
	activate
	delay 2
	tell document frontmost
		set p to 10.1
		set top margin to 0
		set BarcodeBox to make new text box at beginning with properties {bounds:{"0.0 cm", "1.4 cm", "1.3 cm", "8 cm"}, box shape:rectangular, color:null, name:"BarcodeBox"}
		set p to 10.2
		set story 1 of BarcodeBox to TempAttachmentName
		set p to 10.3
		set size of story 1 of BarcodeBox to 9
		set p to 10.4
		set font of every paragraph of BarcodeBox to "IDAutomationHC39M"
		#
		set p to 11
		set NameBox to make new text box at beginning with properties {bounds:{"0.4 cm", "8.5 cm", "1.2 cm", "20 cm"}, box shape:rectangular, color:null, name:"NameBox"}
		set p to 11.1
		set story 1 of NameBox to my PreserveFileName
		set p to 11.2
		set size of story 1 of NameBox to 16
		set p to 11.3
		set font of every paragraph of NameBox to "Cochin"
	end tell
end tell
tell application "QuarkXPress"
	activate
	do shell script ("sleep 0.2")
	tell project 1
		set thePrintName to ("Print " & name of layout space 1) as text
	end tell
	try
		set p to 17
		tell application "System Events" to tell process "QuarkXPress"
			set p to 18
			keystroke "p" using command down
			do shell script ("sleep 0.2")
			tell window thePrintName
				set x to 0
				tell pop up button 1
					click
					repeat until exists menu 1
						set x to x + 1
						if x ≥ 40 then exit repeat
						do shell script ("sleep 0.1")
					end repeat
					do shell script ("sleep 0.1")
					tell menu 1
						click menu item (my theLargePagePrinter)
					end tell
				end tell
				do shell script ("sleep 0.1")
				tell pop up button 2
					click
					repeat until exists menu 1
						set x to x + 1
						if x ≥ 40 then exit repeat
						do shell script ("sleep 0.1")
					end repeat
					do shell script ("sleep 0.1")
					tell menu 1
						click menu item (my theLargePagePrinter)
					end tell
				end tell
				keystroke return
				keystroke return
			end tell
		end tell
	end try
end tell

You may use my old trick

set pageHeight to page height
try
pageHeight as integer
on error errMsg
# extract the numerical component from errMsg
end try

I don’t own/use Xpress so I can’t write the precise code extracting the numerical value.

Yvan KOENIG running Yosemite 10.10.4 (VALLAURIS, France) jeudi 23 juillet 2015 16:46:38

Thanks Yvan, every helpful as usual

Unfortunately the error message only contains the data, as a data message.

Whatever format Quark is returning, it cannot be coerced or displayed. They deserve shooting for their lack of support.

The error message…

Can’t make «data FXVM00001803» into type text.

Regards

Santa

Thanks to Shane Stanley, I’ve succeeded with the following code.

Regards

Santa


set addBarCode to true
set TempAttachmentName to "(20150724121212Z)"
set PreserveFileName to "This is a QuarkXPress test"

tell application "QuarkXPress"
	activate
	repeat until exists document 1
		delay 0.1
	end repeat
	if addBarCode then
		tell document 1
			set vertical measure to inches
			set tool mode to drag mode
			set tempHeight to page height
	 		set CoercedPageHeight to coerce tempHeight to real
		end tell
		tell document frontmost
			set page height to CoercedPageHeight + 0.6
			set EverySelection to select every generic box
			set thelist to bounds of current box as list
			set newa to coerce item 1 of thelist to real
			set newb to coerce item 2 of thelist to real
			set newc to coerce item 3 of thelist to real
			set newd to coerce item 4 of thelist to real
			set bounds of current box to {newa + 0.6, newb, newc + 1, newd}
			set top margin to 0
			set p to 10.1
			set top margin to 0.0
			set BarcodeBox to make new text box at beginning with properties {bounds:{"0.0 cm", "1.4 cm", "1.3 cm", "7.2 cm"}, box shape:rectangular, color:null, name:"BarcodeBox"}
			set p to 10.2
			set story 1 of BarcodeBox to TempAttachmentName
			set p to 10.3
			set size of story 1 of BarcodeBox to 9
			set p to 10.4
			set font of every paragraph of BarcodeBox to "IDAutomationHC39M"
			#
			set p to 11
			set NameBox to make new text box at beginning with properties {bounds:{"0.4 cm", "7.5 cm", "1.2 cm", "20 cm"}, box shape:rectangular, color:null, name:"NameBox"}
			set p to 11.1
			set story 1 of NameBox to my PreserveFileName
			set p to 11.2
			set size of story 1 of NameBox to 16
			set p to 11.3
			set font of every paragraph of NameBox to "Cochin"
		end tell
	end if # set page height to pageHeight
end tell