Is it possible to script the Export in PDF of a layout? I have Script Debugger 4 and have been trawling thru the dictonary and can’t find any references on PDF. When I search ‘PDF’ it sends me to “QuarkXpress Ancillary Objects” but I’m finding nothing in there about PDF!
Since the PDF filter is an Xtension, maybe it can’t be accessed via Applescript. Any comments?
=Alan R.
Model: PowerPC G5
AppleScript: 1.10.6
Browser: Safari 417.9.3
Operating System: Mac OS X (10.4)
In this case the PDF’s are only reference files and, AFAIK, not used for actual printing. So it would seem that running distiller just for that would be way overkill. But it is great to get a confirmation to my suspicions that it can’t (currently) be done.
Alanvee, if you script is only a very basic one you do have the option to use UI scripting to Export PDF to desktop. I use the watched folder and distiller route myself but i don’t know your requirements.
tell application "QuarkXPress"
activate
tell application "System Events"
tell process "QuarkXPress"
tell menu bar 1
click menu item "Layout as PDF..." of menu " " of menu item "Export" of menu "File"
end tell
delay 1
-- The following lines set the path to the desktop
key down command
keystroke "d"
key up command
delay 1
keystroke return
end tell
end tell
end tell
Awesome idea! Had no clue you could interact with “System Events” that way - I’m such a newbie!
That SHOULD be the perfect solution for this as the PDF’s are just a reference copy of the current project with a custom time-stamp on them. Running Distiller for this seemed too heavy handed. Plus I don’t think they do THAT much Quark stuff anyway.
Or script distiller directly if you don’t want hot folders:
tell application "QuarkXPress"
--Do whatever you need to do before printing
--Print to a PS file in a folder called "PDF Folder" on the desktop
--using variable fileBase in this case as the file name
set PS_file_path to (PathToDesktop & "PDF Folder:" & fileBase & ".ps") as text
print front document PostScript file PS_file_path
delay 1
close document myName saving no
end tell
tell application "Finder" --This will make sure the PS file is finiished before going to Distiller
repeat while not (exists file (PathToDesktop & "PDF Folder:" & fileBase & ".ps"))
delay 1
end repeat
end tell
tell application "Acrobat Distiller 7.0" --Distiller uses POSIX file paths
set POSIXPath2PSFile to POSIX path of (PS_file_path as alias)
set PathToStndDistill to POSIX path of (("Macintosh HD:Library:Application Support:Adobe PDF:Settings:Standard.joboptions") as alias) --you can change this to any setting you have in Distiller
Distill sourcePath POSIXPath2PSFile adobePDFSettingsPath PathToStndDistill
end tell
delay 1
tell application "Finder" --make sure the PDF is done and delete the PS file
repeat while not (exists file (PathToDesktop & "PDF Folder:" & fileBase & ".pdf"))
delay 1
end repeat
try
delete file PS_file_path
end try
end tell