Copy link to clipboard
Copied
I have a really basic script that saves the indesign document, then closes it. I have just got a new computer and an updated version of indesign (2021) and now the script does still work, however an error message also pops up afterwards which is annoying because I have to click ok to get rid of it.
Does anyone know how to fix it so the error message doesn't happen? Seems like it might be specific to Indesign 2021?
Script
main();
function main(){
app.activeDocument.close(SaveOptions.YES);
}
Error message
Maybe wrap in a try/catch to work around:
main();
function main(){
try {
app.activeDocument.close(SaveOptions.YES);
} catch(e) {}
}
Copy link to clipboard
Copied
Works fine for me, assuming I have a document open. If there is no document open, it would throw that error.
Copy link to clipboard
Copied
Are you running InDesign 2021?
I'm definitely running it on an open document. As mentioned when i run it, it still functions correctly i.e it does save and close the document, but it's still throwing up that message. If you're not using 2021 then it must be specific to that version. I didn't get this error message when using 2019 version.
Copy link to clipboard
Copied
I am on 2021 (16.0); OS is Catalina 10.15.6.
Copy link to clipboard
Copied
Oh ok very strange. I'm on Catalina 10.15.7 so wonder if the last update stuffed it up.
Copy link to clipboard
Copied
Maybe wrap in a try/catch to work around:
main();
function main(){
try {
app.activeDocument.close(SaveOptions.YES);
} catch(e) {}
}
Copy link to clipboard
Copied
Thank you! That fixed it.