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

Indesign crasches on save after open

Participant ,
Apr 04, 2017 Apr 04, 2017

Copy link to clipboard

Copied

Hello

I try to open an InDesign document, and then save it to another location.

Im using InDesign CC2015 for windows. This is a .jsx function called from a Createive suite html plugin.

When I try to save the document, InDesign crasches. This only happends on windows, Mac works just fine.

If i call an alert box before saving, everything works just fine. I do not want the alert box. It there any other call I can replace it with?

Causes crash:

if (docObject.templatePath) {

            thedoc = app.open(docObject.templatePath);

            // alert(docObject.templatePath);

            var ff = File(docObject.path);

            if (thedoc && ff) {

                 thedoc.save(ff);

          }

}

Works without probllem:

if (docObject.templatePath) {

            thedoc = app.open(docObject.templatePath);

            alert(docObject.templatePath);

            var ff = File(docObject.path);

            if (thedoc && ff) {

                 thedoc.save(ff);

          }

}

Best Regards

/ Pontus

TOPICS
Scripting

Views

310

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
People's Champ ,
Apr 05, 2017 Apr 05, 2017

Copy link to clipboard

Copied

Unless I am wrong I can't see any point of passing a file argument to the save method as you are actually saving the document to itself.

Only situation where it could make sense is when the document has been converted (i.e opening a template, idml or a former version).

But then you wouldn't catch a "path" as they would be new documents.

But to give your crashes some meaning, maybe this explains it all. As you are trying to rewrite the file onto itself, maybe windows has some underlaying mechanisms that makes indesign crashing.

Once again, save() without argument should do.

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 ,
Apr 07, 2017 Apr 07, 2017

Copy link to clipboard

Copied

Im not saving the document to the same path. Its two different paths. It works just fine on macintosh, but not on windows.

Its 11.4.1.102 x64, running on Windows 7 Enterprice, servicepack 1.

There are some cases where you need to save to the same path. If you open a CS6 dokument in CC and then try to save the document

using the norrmal save command you get a Save As dialog. That is something I would like to avoid because the customer should not have to find the correct place to save the document. The plugin should take care of that.

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
People's Champ ,
Apr 13, 2017 Apr 13, 2017

Copy link to clipboard

Copied

Yes I think we agree on the main idea. Most likely crashes occur when some operation cannot be resolved. The fact it works with an alert might show that the file cannot be written at some point. Using an alert adds a delay that may free the file for further writing operations. I got a script long ago where a routine would work fine on mac all the time but would work only once on windows. After that you had to quit and relaunch indesign to get it working again…once. On the second attempt, Windows claimed for files permissions…

So in your case, you might try to add a $.sleep() command before the save. Maybe a 200ms delay might solve the issue. Maybe it won't especially if the file is located onto a server with a low bandwith network.

Other solution might be to save to a temp location, close the doc, remove the original file and then relocate the temp file to the genuine location. I know this kind of tricks don't make much sense but still if it can solve your issues.

HTH

Loic

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 ,
Apr 18, 2017 Apr 18, 2017

Copy link to clipboard

Copied

LATEST

Thanks for taking the time to help me.

I solved it the following way:

I do a saveACopy to the correct filepath.

Close the open doc, and open the correct doc that I did the saveACopy to.

I will try the $.sleep solution, and hope it works. Its a lot nicer solution.

Regards

/ Pontus

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