InDesign Preflight Panel - Detect Errors

Does anyone have a script that can detect whether the active InDesign 2024 document has any errors reported in the Preflight panel?

Ideally, I’d like to incorporate this into an “End of Ad” script that alerts the operator if any preflight errors are present, so they can review the document more closely before proceeding.

From my initial research, I’m not sure if this is even possible—has anyone been able to achieve something like this?

Hi @Jeffkr,

Preflight is easily scriptable in InDesign:

tell application id "InDn"
	set myProcess to make preflight process with properties {target object:(active document), applied profile:preflight profile 1}
	wait for process myProcess
	set myResult to (aggregated results of myProcess)
	set myErrors to item 3 of myResult
end tell

myErrors will return a detailed list with every issue found by the preflight profile you chose. (Or an empty list if there is no issue.)

OMG! This is exactly what I needed! I cannot thank you enough, ionah!

Thanks again,
-Jeff