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
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()
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.
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
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?
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?
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?
Copy link to clipboard
Copied
stupid question...
my path have not same slash than you...
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"
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
Copy link to clipboard
Copied
Nothing strange at all, see my latest comment.
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
it s not that...
Copy link to clipboard
Copied
script psd and indd are same?
because in psd i have that:
.close(SaveOptions.SAVECHANGES)
Copy link to clipboard
Copied
it s same problem...
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.
Good luck with your project. I am passing hand here.
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
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...
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.
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
Copy link to clipboard
Copied
@laurence roussel12011930I am a bit speechless here:
i feel some file was register with old indd version
By @laurence roussel12011930
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.