Skip to main content
Inspiring
October 19, 2022
Question

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

  • October 19, 2022
  • 1 reply
  • 1995 views

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()

This topic has been closed for replies.

1 reply

Loic.Aigon
Legend
October 19, 2022

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.

 

Inspiring
October 19, 2022

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

Loic.Aigon
Legend
October 19, 2022

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?