Edit: Here is a script that asks for confirmation before closing a document:
#target Indesign
#targetengine "closeConfirmation"
app.addEventListener("beforeClose", confirmClose);
function confirmClose(e) {
if(e.parent.constructor.name !== "LayoutWindow") return;
if (confirm ("Did you proof your page?") === false) {
e.stopPropagation();
e.preventDefault();
}
}
And here is the original post about the same thing for a beforePrint
event:
#target Indesign
#targetengine "printConfirmation"
app.addEventListener("beforePrint", confirmPrint);
function confirmPrint(e) {
if (confirm ("Do you really want to print?") === false) {
e.stopPropagation();
e.preventDefault();
}
}
Note that the first one has an additional if clause, because when closing a document, both the Document
and the LayoutWindow
will trigger the event. So, if you would not cancel one of them, it would ask you twice.
You can move these to your startup scripts folder then they automatically register the events once InDesign is started.