need to print text box outside of page guides

Discuss AppleScripting for QuarkXPress 10, 9 & 8 (and before)
Post Reply
oOzSanta2
Posts: 0
Joined: 29 Jul 2014, 23:16

need to print text box outside of page guides

Post by oOzSanta2 » 29 Jul 2014, 23:28

G'day scripters

I have a large script that prints QuarkXPress files. These files come in via email, and are processed automatically, and a barcode is added above the top margin, because sometimes the page is full of items. However, while the newly processed file is saved with the barcode, the barcode does not print, because printing only prints within the margins.

I need a way of increasing the document dimensions, or reducing the top margin, so the barcode prints.

Is such a thing possible?

Regards

Santa
Jean-Marie Schwartz
Posts: 1162
Joined: 23 Nov 2004, 04:30

Re: need to print text box outside of page guides

Post by Jean-Marie Schwartz » 30 Jul 2014, 03:06

Hi! At the Document level, you'll want to set up a Print Setup Record so that the print aera covers the object you need. Check the dictionary for further information. Come back with a piece of code if any help needed.
Jean-Marie Schwartz

= Mac Pro Quad-Core Intel 2.8 GHz • 10 Go 1066 MHz DDR3 • Mac OS 10.10.5 • QuarkXPress 9.5.4.1 + QuarkXPress 2017 • Adobe CS5 =
oOzSanta2
Posts: 0
Joined: 29 Jul 2014, 23:16

Re: need to print text box outside of page guides

Post by oOzSanta2 » 21 Jul 2015, 20:27

This is a very late response, I know, but I've had to revisit this topic after a year.

I still cannot get the two new text boxes to print, even when I reduce the top margin to zero.

Ideally I'd like to increase the page height by an inch, and place and print the text boxes in that extra inch. The page heights can vary from job to job.

I've tried the following...

Regards

Santa

Code: Select all

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 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 story 1 of BarcodeBox to TempAttachmentName
		 set size of story 1 of BarcodeBox to 9
		 set font of every paragraph of BarcodeBox to "IDAutomationHC39M"
		#
		 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 story 1 of NameBox to my PreserveFileName
		set size of story 1 of NameBox to 16
		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
		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
oOzSanta2
Posts: 0
Joined: 29 Jul 2014, 23:16

Re: need to print text box outside of page guides

Post by oOzSanta2 » 23 Jul 2015, 05:02

G'day

I've managed to get two added text boxes to print by setting the top margin to zero, when the text boxes are set just below the document top, by selecting the PPD (my correct printer) in the Pages section, instead of the Generic Printer setting, in the Print Dialog box.

However, I'd still like to add one inch to the document size, and place the text boxes in that added inch.

Any advice, please?


Santa
oOzSanta2
Posts: 0
Joined: 29 Jul 2014, 23:16

Re: need to print text box outside of page guides

Post by oOzSanta2 » 24 Jul 2015, 04:17

With help from the Applescript Users Group, the following code works. Note the required use of two different 'tell document' statements.

Code: Select all

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

Post Reply

Return to “QuarkXPress 8, 9 & 10: AppleScript”