Preflight idml files - No errors yet; still looking

One of the processes we commonly run against InDesign Server (IDS) is preflight.

Preflight takes an InDesign file and an InDesign profile and produces a report that tells you whether the InDesign file conforms to the profile.

You can create your own profile or use the default InDesign Desktop profile. The default profile checks you have all the linked files and fonts used in the .indd file. It also checks other things like colorspace, resolution, overset text etc.

We noticed that IDS wasn't producing a preflight report for some .idml files.

After a little investigating and running the files against IDS from the command line using the sampleclient.exe tool observing the output of the IDS console we noticed a funny message: No errors yet; still looking

In code we had this:

1var indesignFile = app.open(File(<indesign file path>));
2var profile = app.loadPreflightProfile(File(<profile file path>));
3var process = app.preflightProcesses.add(indesignFile, profile);
4process.waitForProcess();
5var results = process.processResults;
6process.saveReport(File(<report file path>));

It turns out you need two waitForProcess()es! This worked:

1var indesignFile = app.open(File(<indesign file path>));
2var profile = app.loadPreflightProfile(File(<profile file path>));
3var process = app.preflightProcesses.add(indesignFile, profile);
4process.waitForProcess();
5process.waitForProcess();
6var results = process.processResults;
7process.saveReport(File(<report file path>));

Thanks to this German forum post for the suggestion.

Update 13 Sep 2023: This is now logged as a bug on Adobe's User Voice SDK/Scripting Bugs topic.