I have a script below that opens up a quark file and creates a PDF file. (It works for both InDesign and Quark). It uses a custom PDF setting that I have created called “C2Media_PDF.joboptions” (so if you try it out you will need to replace that with one of your regular settings)
For catalogs, it is giving me a timeout error…However, the script does finish regardless of that.
Is there anyway to tell the script to ignore this kind of error?
on open fileList
set deskPath to path to desktop as Unicode text
tell application "Finder"
repeat with i from 1 to count of items of fileList
set theFile to item i of fileList
if not ((kind of theFile starts with "Quark") or (kind of theFile starts with "InDesign")) then
display dialog "This file is not an InDesign or Quark document!" buttons "Skipping" default button "Skipping" with icon 0 giving up after 6
return
end if
--Determine whether to use InDesign subroutines or Quark subroutines
if (kind of theFile starts with "InDesign") then -- Process as InDesign
set fileName to name of theFile
my createInDesignPDF(theFile, deskPath, (text 1 thru -6 of fileName))
else -- Process as Quark
my createQuarkPDF(theFile)
end if
end repeat
end tell
end open
on createInDesignPDF(theFile, savePath, docName)
tell application "Adobe InDesign CS3"
open theFile
set theProps to properties of PDF export preset "[C2Media_PDF.joboptions]"
set newProps to {view PDF:false, page range:"all", crop marks:false, bleed marks:false, color bars:false, registration marks:false} & theProps
set oldProps to properties of PDF export preferences
set properties of PDF export preferences to newProps
export front document format PDF type to (savePath & docName & ".pdf") without showing options
set properties of PDF export preferences to oldProps
close front document saving no
end tell
end createInDesignPDF
on createQuarkPDF(theFile)
tell application "QuarkXPress"
open theFile
activate application
try
tell document 1 to set suppress printing of every image of (every picture box whose missing of image 1 is true) to true
end try
end tell
tell application "System Events"
tell process "QuarkXPress"
click menu item "Layout as PDF..." of menu 1 of menu item "Export" of menu 1 of menu bar item "File" of menu bar 1
delay 5
click button "Save" of window "Export as PDF"
delay 5
end tell
end tell
tell application "QuarkXPress"
activate
close front document saving no
end tell
end createQuarkPDF
with timeout of 20 * minutes seconds
-- the common syntax is
-- with timeout of integer seconds
-- the integer value is 20 * minutes (= 20 * 60 = 1200)
end timeout
Tom
Browser: Firefox 3.6.3
Operating System: Mac OS X (10.6)
Hello!!
OK, I have tried both of your codes…
I have placed them in different parts of the script, but nothing yet.
Can you please guide me as to where your code would be placed in my script…I am not use to working with either of these commands…thanks so much!!!
babs
Well, the interesting thing is, that the script will finish and the PDF will be made from the quark document and it will be OK.
I was getting the error around page 30 of the document, where there are some really large images. It’s just more of an annoyance than anything else. And it doesn’t happen on all our catalogs, just a few, but like I said, the PDF seems OK.
I was just trying to find away to get rid of the message.
So, in a nutshell, the script itself keeps going, even after the message comes on screen.
Weird…huh
babs
Try to wrap the handlers in to an “ignoring application responses”-block.
Scirpt:
on open fileList
set deskPath to path to desktop as Unicode text
tell application "Finder"
repeat with i from 1 to count of items of fileList
set theFile to item i of fileList
if not ((kind of theFile starts with "Quark") or (kind of theFile starts with "InDesign")) then
display dialog "This file is not an InDesign or Quark document!" buttons "Skipping" default button "Skipping" with icon 0 giving up after 6
return
end if
--Determine whether to use InDesign subroutines or Quark subroutines
if (kind of theFile starts with "InDesign") then -- Process as InDesign
set fileName to name of theFile
my createInDesignPDF(theFile, deskPath, (text 1 thru -6 of fileName))
else -- Process as Quark
my createQuarkPDF(theFile)
end if
end repeat
end tell
end open
on createInDesignPDF(theFile, savePath, docName)
ignoring application responses
tell application "Adobe InDesign CS3"
open theFile
set theProps to properties of PDF export preset "[C2Media_PDF.joboptions]"
set newProps to {view PDF:false, page range:"all", crop marks:false, bleed marks:false, color bars:false, registration marks:false} & theProps
set oldProps to properties of PDF export preferences
set properties of PDF export preferences to newProps
export front document format PDF type to (savePath & docName & ".pdf") without showing options
set properties of PDF export preferences to oldProps
close front document saving no
end tell
end ignoring
end createInDesignPDF
on createQuarkPDF(theFile)
ignoring application responses
tell application "QuarkXPress"
open theFile
activate application
try
tell document 1 to set suppress printing of every image of (every picture box whose missing of image 1 is true) to true
end try
end tell
tell application "System Events"
tell process "QuarkXPress"
click menu item "Layout as PDF..." of menu 1 of menu item "Export" of menu 1 of menu bar item "File" of menu bar 1
delay 5
click button "Save" of window "Export as PDF"
delay 5
end tell
end tell
tell application "QuarkXPress"
activate
close front document saving no
end tell
end ignoring
end createQuarkPDF
OK-first it wasn’t doing anything, other than opening and closing the quark file.
So, I removed the first ignore you had in the InDesign area, which is fine, since I am only going too use this one for the quark files.
I left it on for the quark part and it worked like a charm!!!
AWESOME!!! :lol::lol::lol: