I don't no anything about
the scripting possibilitys nor do i about applescript.
However, if everything else isn't possible:
At least in VBcript it is no problem to check if the job finished. Either by checking the thread or by checking the pdf files.
If you're script still uses document. exportFile(), nothing will change. For example, the following code will still work:
t = app.activeDocument.exportFile(ExportFormat.pdfType, File("~/Desktop/Test.pdf")); alert("Task is done")
If you want to use the 'background tasks' functionality, you'll need to use document.asynchronousExportFile(). AsynchronousExportFile returns a background task, which has the method waitForTask(). You can use it something like this:
t = app.activeDocument.asynchronousExportFile(ExportFormat.pdfType, File("~/Desktop/Test.pdf")); t.waitForTask(); alert("Task is done")
This will export your document as a PDF using a background task, wait for the export to complete, and then pop up an alert. The problem is that you loose the advantages of a background task (namely, you can do other things while the file is exporting in the background).
The backgroundTask object has a property status, which returns the status of the task, including TaskState.COMPLETED. You could probably add an event listener to check for the state change from TaskState.RUNNING to TaskState.COMPLETED. When I get a bit more time later, i'll check it out and try to provide some sample code.
Again, if your concern is the behavior of scripts you already have, then nothing should change. If you're looking to take advantage of the new background tasks, then there's some work to do.
Thanks, this makes sense. A quick test has pretty well confirmed it.
I never make any assumptions about things not changing, when a new application version hits. Maybe for 1 version of ID, things were "the same" and did not require me to overhaul lots of scripts. So at this point I assume everything important I do is broken so I go over it and check everything out. (Guess I'm gun shy from all the changes. Damn you Adobe, Apple!)
Anyone know if background exporting to pdf is more memory efficient? Also, do you need to turn it on in a script (AS)?
I've been using scripts to automate pdf exporting for years. But (after fairly recently moving to CS5) I ran into a case where, when exporting what should have been a 99 MB pdf, the finished pdf was smaller than that and was missing a few placed graphics toward the end of the document. On repeated attempts, this was repeated somewhat randomly (sometimes more, sometimes fewer graphics dropped). I was finally able to get it to work by manually exporting.
I noticed that the script export was not in the background, so now I'm thinking, maybe background exporting just works better in CS5?
I don't know if it uses memory differently -- it just does the export on a background thread. You don't turn it on; you just use a different command, asynchronous export file. I haven't used it myself, but given your problems, it sounds worth a try.
Do you know if asynchronousExportFile is available on InDesign Server? I'm testing a script that works locally on my computer with ESTK but when the script executes on IDS, it throws the following error:
Where 'myDoc' is a document object (like I said, it works fine when I test it locally).
@Uwe, thank you for the info.