Create script for batch qxp 9.3 pdfs

Discuss AppleScripting for QuarkXPress 10, 9 & 8 (and before)
Heather Holmes
Posts: 12
Joined: 06 Mar 2012, 21:55

Create script for batch qxp 9.3 pdfs

Post by Heather Holmes » 01 Mar 2013, 15:45

Does anyone have a working script that opens multiple qxp 9.3 documents and exports them to pdf/x-1? When multiple qxp documents (that harbor over a network) are ready for export to pdf, I open them one by one, export to pdf to a designated folder on the network, and close. This becomes very tedious when there is 400 or so documents per week. Any help would be appreciated. Thanks!IMac 10.7.5 quark 9.3.1

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

Create script for batch qxp 9.3 pdfs

Post by Jean-Marie Schwartz » 03 Mar 2013, 22:19

Hi Heather! Different approaches can be handled. Would you rather drag PDFs from time to time from network folder to say desktop then process the file and send the PDF back to the network? Or would you rather drag an entire folder of files once a day to your desktop and batch process those files? Or would you prefer to simply drag QXP files one at a time on a droplet?
Is there any check to perform prior to save as PDF?

Heather Holmes
Posts: 12
Joined: 06 Mar 2012, 21:55

Create script for batch qxp 9.3 pdfs

Post by Heather Holmes » 04 Mar 2013, 03:30

Hi Jean-Marie - Ideally, what I would like to happen would be to grab all of the file names (perhaps out of an excel document), have quark open each item, export layout as pdf with PDF style PDF/X-1a:2001 to a designated folder on the network/server, then close the quark documents with no changes. No checks to perform prior to saving as a pdf. 99.9% of the time that is already accomplished.

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

Create script for batch qxp 9.3 pdfs

Post by Jean-Marie Schwartz » 04 Mar 2013, 04:16

All right. Is it OK if the droplet (you drop the files on the droplet icon in the Finder) saves all the PDFs on the Desktop (even in a particular folder) and then up to you to post those PDFs on the server? (or do you prefer having the PDFs saved straight on the sever with no file on the Desktop? Is the path to the server always the same? Or are the PDFs spread over several or different folders?

Emma
Posts: 657
Joined: 07 Jul 2004, 08:43

Create script for batch qxp 9.3 pdfs

Post by Emma » 04 Mar 2013, 04:20

Jean-Marie - I have something similar, but the code has gone a bit peculiar. However here is the bit where you choose a destination folder which you are welcome to use:
set dest_folder to (choose folder with prompt "Select destination folder for pdfs") as alias

and then the save as pdf command, which has gone weird:
event PDSUXDOC given class kfil:((dest_folder & pdf_name) as string), class fltp:"PDF", class POST:"TTS PDF"

(TTS PDF is just the pdf setting to use. The script runs fine so I don't know where all this kfil and event stuff has come from, otherwise I would have offered help earlier!)

Heather Holmes
Posts: 12
Joined: 06 Mar 2012, 21:55

Create script for batch qxp 9.3 pdfs

Post by Heather Holmes » 04 Mar 2013, 05:04

The pdfs can be moved to another folder on the server quite easily - so that wouldn't be a problem at all. It's the tediousness of opening every single quark document and exporting to pdf that takes so long.

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

Create script for batch qxp 9.3 pdfs

Post by Jean-Marie Schwartz » 04 Mar 2013, 05:17

Sure, the aim of my questions is just to code as far as possible. So if the path is unique, than I can simply hard code it (or let you do it yourself)? But if the destination folders are spread over the network, then I'd rather go the dialog route in order to let you enter at it each time. Are you with me?
So for saving a Quark file as PDF, the code is very simple. The droplet bit is very easy too.
Here you go:
property path_to_desktop : path to desktop as string
property list_of_errors : {}


on open these_items
--set these_items to choose file with multiple selections allowed
repeat with i from 1 to the [b]count [b]of these_items
[b]set this_item [b]to (item i [b]of these_items)
[b]tell application "QuarkXPress95"
[b]try
[b]open this_item [b]with Suppress All Warnings
[b]on [b]error
[b]my Bip(3)
[b]return
[b]end [b]try
[b]set the_project [b]to document 1
[b]set the_name [b]to name [b]of the_project
[b]try
[b]export the_project in ((path_to_desktop) & the_name & ".pdf") as "PDF" PDF output style "PDF/X-1a:2001"
[b]on [b]error
set end of list_of_errors to the_nameend tryclose the_project without savingend tellmy Bip(2)end repeatend openon Bip(x)beep xend Bip

Heather Holmes
Posts: 12
Joined: 06 Mar 2012, 21:55

Create script for batch qxp 9.3 pdfs

Post by Heather Holmes » 04 Mar 2013, 05:30

I apologize, but I am not seeing anything after Here you go: Thanks!

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

Create script for batch qxp 9.3 pdfs

Post by Jean-Marie Schwartz » 04 Mar 2013, 05:59

My bad. I did it on purpose to avoid Post Pending Moderation[;)] But I had some things to tweak in the meanwhile.
So copy/paste the code in your script editor and save it as an application. Then you'll simply need to drop Quark files on it. Well, the script will not check wether the file is a Quark file or not I presume you'll only process Quark files. The PDFs will be created on the Desktop. Let me know if you want some help for saving those straight onto the server or gathered in a single folder on the Desktop or whatever. (Please also check the PDF settings name in your environment: mine is "PDF/X-1a:2001").
Well come back if things don't run as expected.

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

Create script for batch qxp 9.3 pdfs

Post by Jean-Marie Schwartz » 04 Mar 2013, 06:01

Hi Emma! Most of the time, when classes are turning up it means you must relaunch Quark. Don't know in this case if it'll help. What version of Quark are you on again?

Post Reply

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