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

Launch script with "Startup script" folder

New Here ,
May 11, 2017 May 11, 2017

Copy link to clipboard

Copied

Hello,

I have a script that process, save and close some documents.

I'm having some problems when I launch it using the "startup script" folder: when the script tries to close documents using the standard function myDocument.close(SaveOptions.NO), the documents aren't closed.

But, if I launch the same script with ExtendScript Toolkit, documents are closed correctly.

Any thoughts?

Thank you

TOPICS
Scripting

Views

955

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
Mentor ,
May 11, 2017 May 11, 2017

Copy link to clipboard

Copied

Hi,

Paste a code pls.

How your code is calling/refering to myDocument?

Jarek

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
New Here ,
May 11, 2017 May 11, 2017

Copy link to clipboard

Copied

Hi Jarek,

it's difficult to paste the entire code because I'm including external libraries, but I'm using the app.open() function in this way:

var templateFullName = File("C:/template.indt");

var myDoc = app.open(templateFullName, false);

//Some stuff

//...

myDoc = myDoc.save(File("C:/output.indd"));

myDoc.close(SaveOptions.YES);

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
New Here ,
May 12, 2017 May 12, 2017

Copy link to clipboard

Copied

LATEST

Hi,

I've just simplified my code with this one and tested it with both "Startup script" folder and Extendscript Toolkit

#target "indesign-11.064"

var doc = null;

for(var i = 0; i < 10; i++) {

  doc = app.open(File("C:/ScriptTest/INPUT/template.indt"), false);

  doc = doc.save(File("C:/ScriptTest/OUTPUT/" + i + ".indd"));

  doc.close(SaveOptions.YES);

  $.sleep(2000);

}

This is the result just before the script completed:

Script_BeforeCompleted.PNG

This one after the script completed:

Script_Completed.PNG

It seems that documents have been closed at the end of the process.

But I'm not able to find why it happens, because using the toolkit, every document is closed immediately.

Thank you for your help

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