I have a massive applescript that preps Indd files for print or export, everything works great except the export will timeout.
I have tried using "with timeout" of varying lengths, even up to 3 days.
with timeout 86400 seconds
or
with timeout 72* hours seconds
Still times out...
So I thought I would get creative:
-----------------
on letswait()
tell application "Finder"
activate
set indyfail to display dialog "InDesign thinks it has failed
Wait and Acrobat will probably open with the proof
Click continue when it does, click quit if it doesn't" buttons {"Quit", "Continue"} default button 2 giving up after 120
end tell
if (button returned of indyfail = "") then
letswait()
end if
if (button returned of indyfail = "Quit") then
return {quitting:"true"}
end if
end letswait
on ExportPDF(savePath)
tell application "Adobe InDesign CS2"
set myDocument to active document
activate
-- exporting
tell PDF export preferences
--page range can be either all pages or a page range string
set page range to "2-" & (count of pages of myDocument)
set view PDF to true
end tell
end tell
try
tell application "Adobe InDesign CS2"
tell myDocument
with timeout of 400 seconds
export format "Adobe PDF" to savePath using "Export Proof"
end timeout
end tell
end tell
on error
--delay 60
letswait()
end try
end ExportPDF
-----------------
The above is saved on the server and is called from the main script:
set foo to load script file "Artwork:Libraries:Automation:Proofs:Export.scpt"
set exported to foo's ExportPDF(savePath)
Ok, so the idea is that I am expecting InDesign to report a timeout. Finder then pops up a dialog telling the user that they need to just wait. When Acrobat opens with the PDF (because the setting is there to open PDF after) they click continue. The Finder dialog is set to close every 2 minutes and reopen if no button was clicked.
Now I'm getting a Finder timeout... I can't win :P
I've had a timeout on the finder part, I've had a timeout of much greater length on the PDF export. Nothing seems to matter, it fails.
I could probably use better error handling because there are times when the export legitimately fails to export. That is not as common as the timeout which happens with almost every single run of the script.
I've searched these forums looking for a solution, but no luck. 😞
Any ideas?