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

problem with .close(saveoption.yes) and doc.links.everyItem().update();

Explorer ,
Oct 19, 2022 Oct 19, 2022

Copy link to clipboard

Copied

hi, sorry to disturb, but i have soon finish a script for open and update all link into a .indd file

 

i have 70 files wirth same construction type inside, and 68 files work correctly and 2-3 files block on doc.close(saveoption.yes)

 

ad i don t know really why...

 

wich alternative there is for force save without any question

i use 

app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;

 

when i return open the document sometime all is ok, but if i want do ctrl+s, it open a windows for propose where save, and for the other file there is not this windows...

 

 

second question: doc.links.everyItem().update();  it update all link inside the indd file, it update psd, .doc,.jpg,.png?

 

because i have a doubt about link with this type of document

into my script i will open all link idd type file, and before close my document i do doc.links.everyItem().update()

TOPICS
Scripting

Views

169

Likes

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
Valorous Hero ,
Oct 19, 2022 Oct 19, 2022

Copy link to clipboard

Copied

It's likely that the 2/3 files were never saved. So you ask InDesign "Please save files" but InDesign doesn't just know where to, so it asks. Why is it that the file is not saved? Maybe a file saved with a prior version of InDesign that is converted to the newer format as a new file with no save history. Same could happen with idml or indt.

Even if you force InDesign to not displauy dialogs, it doesn't have a choice. Sensei is not reday yet. To circumvent this, you can check document.filePath for file existence. If file exists, save(SaveOptions.YES) will do. Otherwise, if you know the genuine file path then save new file to old file save(File(oldFilePath)).

And yes, InDesign does update links given that the source link file exists and InDesign has access to it.

You may want to separate your posts for the specific concern. Otherwise, answers may cross and it gets confused.

 

Likes

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
Explorer ,
Oct 19, 2022 Oct 19, 2022

Copy link to clipboard

Copied

file exist since long time, open and save and close, lot of time recently, and problem restart each time with script

Likes

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
Valorous Hero ,
Oct 19, 2022 Oct 19, 2022

Copy link to clipboard

Copied

I want to believe you but there is no obvious reason why InDesign would fire a save to dialog if it can save the file. In this kind of situation, you can write a simple test script:

app.open(myFile).close(SaveOptions.YES)

And see how the file behaves. If no dialog, issue is elsewhere in the script or something else the script does that leads to this dialog. Can you do the test?

Likes

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
Explorer ,
Oct 19, 2022 Oct 19, 2022

Copy link to clipboard

Copied

sorry now i m alone and very tired for try to understand all, i want do your test before sleep but i m not sur

 

 

my file , need filepath to active document?

and how to write OR condition? 

if (f[i].displayName == ("étiquette finie.indd" || "cataloguephykidis - fiche tech.indd" ||"cataloguephykidis.indd"))
 
because not work

Likes

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
Valorous Hero ,
Oct 19, 2022 Oct 19, 2022

Copy link to clipboard

Copied

Just get the path to your problematic doc (the one rising the dialog):

save those two lines to test.jsx

var myPath = "/this/is/the/file.indd"

app.open(File(myPath)).close(SaveOptions.YES);

run test.jsx

Do you have Save Dialog opened?

 

Likes

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
Explorer ,
Oct 19, 2022 Oct 19, 2022

Copy link to clipboard

Copied

stupid question...

 

my path have not same slash than you...

var myPath = "M:\infographie\Dossier Phykidis\base de donnée produit\pkd\GAMMES\jambes\188\Fiche produit\fiche produit.indd"

app.open(File(myPath)).close(SaveOptions.YES);

run test.jsx

Likes

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
Valorous Hero ,
Oct 19, 2022 Oct 19, 2022

Copy link to clipboard

Copied

No worries but in that case, you need to double the backslash as the backslash is an escaping character in javascript.

var myPath = "M:\\infographie\\Dossier Phykidis\\base de donnée produit\\pkd\\GAMMES\\jambes\\188\\Fiche produit\\fiche produit.indd"

Likes

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
Explorer ,
Oct 19, 2022 Oct 19, 2022

Copy link to clipboard

Copied

wow \\ strange

 

Eval Error (#25): "Expected: ;" in 'C:\Users\adrien\Desktop\test.jsx' [5:5] in host 'indesign-17.064 (main)'.

 

 

my neighbourd hate javascript

Likes

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
Valorous Hero ,
Oct 19, 2022 Oct 19, 2022

Copy link to clipboard

Copied

Nothing strange at all, see my latest comment.

Likes

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
Explorer ,
Oct 19, 2022 Oct 19, 2022

Copy link to clipboard

Copied

var myPath = "M:/infographie/Dossier Phykidis/base de donnée produit/pkd/GAMMES/jambes/188/Fiche produit/fiche produit.indd"

app.open(File(myPath)).close(SaveOptions.YES);

run test.jsx

 

SAME PROBLEM error 25

 

i go to the bed....i m detroy

Likes

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
Explorer ,
Oct 20, 2022 Oct 20, 2022

Copy link to clipboard

Copied

i have start the script on my big fly, and at 30%, i have the first error on close(saveoption.yes)

 

this line was used maybe 15 time before crash

and i don t understand the reason

Likes

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
Explorer ,
Oct 20, 2022 Oct 20, 2022

Copy link to clipboard

Copied

try again same problem on same file

file look like ok

 

i feel the png is the problem i try something

Likes

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
Explorer ,
Oct 20, 2022 Oct 20, 2022

Copy link to clipboard

Copied

it s not that...

Likes

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
Explorer ,
Oct 20, 2022 Oct 20, 2022

Copy link to clipboard

Copied

script psd and indd are same?

 

because in psd i have that:

.close(SaveOptions.SAVECHANGES)

Likes

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
Explorer ,
Oct 20, 2022 Oct 20, 2022

Copy link to clipboard

Copied

it s same problem...

Likes

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
Valorous Hero ,
Oct 20, 2022 Oct 20, 2022

Copy link to clipboard

Copied

Wait w00t ?! What is PS coming in the debate? No, methods may be occasionally similar but you can't expect PS-designed methods to work by nature within InDesign. 

Capture d’écran 2022-10-20 à 19.19.40.png

 

Good luck with your project. I am passing hand here.

Likes

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
Explorer ,
Oct 20, 2022 Oct 20, 2022

Copy link to clipboard

Copied

sorry i m not specialist, it s not my job,  i try to resolve a problem by my self, and it s really not easy when you are not familiar with it, and my job not accord me lot of free time.

thanks for you help loic

Likes

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
Explorer ,
Oct 20, 2022 Oct 20, 2022

Copy link to clipboard

Copied

i have try this: 

        try {
        doc.save();
        doc.close();
        }catch(err){
        alert(err.line+" => "+err.message);
        }

 

 

and it work on the problematic file, now i test with more file

 

for exemple: it s not possible for me to understand why doc.close not work but try (doc.close), work.... it s not really easy when you are 0...

Likes

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
Valorous Hero ,
Oct 20, 2022 Oct 20, 2022

Copy link to clipboard

Copied

if the script fails without try/catch, there are 0, like 0 reasons it would wok just because you had try/catch. The only exception would be that you don't process the error.

Exemple: 

try{

 //bad code that throws error

}

catch(err){

     //no action at all here

}

 

In this case, error is thrown but your code would ignore it.

 

Anyway, a nth digression that gets us away from the original trouble, i.e. that closing/saving will in some case throw a dialog. The point of the simple test code was to check if the behaviour was reproducible. If not it means that the culprit is elsewhere in your code.

You are back to step by step debugguing.

Likes

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
Explorer ,
Oct 21, 2022 Oct 21, 2022

Copy link to clipboard

Copied

i have try an other thing, i have open each link per group, for each etiquette fini.indd

 

ctrl+alt+shift+s = some file open a "save as",date to this file was 2021, after ctrl+alt+shift+w

i have start my script on all my file, and i have success it for first time

 

i feel some file was register with old indd version

Likes

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
Valorous Hero ,
Oct 21, 2022 Oct 21, 2022

Copy link to clipboard

Copied

LATEST

@laurence roussel12011930I am a bit speechless here:

quote

i feel some file was register with old indd version


By @laurence roussel12011930

Capture d’écran 2022-10-21 à 13.20.48.png

 

 I told you that it could be an option and you denied it. Now you say it could be…I understand that you are in need for help and possibly trying. Yet what we expect in those case is a minimum of humility when experts suggest issues that you just throw away without a concern.

And I am trying to stay measured.

Likes

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