• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Indesign simple script works but also gives error message

Participant ,
Nov 18, 2020 Nov 18, 2020

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

danielw42205661_0-1605740729464.png

 

TOPICS
Scripting

Views

278

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Nov 18, 2020 Nov 18, 2020

Maybe wrap in a try/catch to work around: 

 

main();

function main(){

try { 
   app.activeDocument.close(SaveOptions.YES);
} catch(e) {}

}

Votes

Translate

Translate
Community Expert ,
Nov 18, 2020 Nov 18, 2020

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. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 18, 2020 Nov 18, 2020

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. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 18, 2020 Nov 18, 2020

Copy link to clipboard

Copied

I am on 2021 (16.0); OS is Catalina 10.15.6.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 18, 2020 Nov 18, 2020

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. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 18, 2020 Nov 18, 2020

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) {}

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 18, 2020 Nov 18, 2020

Copy link to clipboard

Copied

LATEST

Thank you! That fixed it. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines