Copy link to clipboard
Copied
Hi scripters, I am experiencing a bug trying to update a placed pdf graphic (.ai document). I came across this bug, lodged by @Peter Kahrel which describes the same bug I'm experiencing, but it seems that it wasn't able to be followed-up due to difficulty in reproducing it.
I have put together a simple test case that reliably (for me) triggers the bug, and I would be grateful if people could try it out and report if they see the bug like I do, or not. Please leave comment if you get a result either way, including your OS and Indesign version.
Needless to say if anyone knows a solution, or a workaround, I would love to hear that too.
To set up the test, just download the attached script, .indd and .pdf and put them into a folder together. I've put instructions for two tests in the comment at the start of the script. Here it is:
/**
* To set up the tests:
* 1. have the demo.indd in folder with this script
* 2. have the linked graphic in folder with this script
*
* TEST 1: Do not open "demo.indd" before running script (let the script do it).
* TEST 2: have "demo.indd" open before running the script.
*
* My results, using Indesign 18.3 MacOS 13.4:
*
* TEST 1 RESULT:
* - error during call to "graphic.place"
* - throws "Error: This file is already open by another user or another application. This file may be stored on a network server and cannot be opened until the other user closes it."
* - placed pdf graphic DOES NOT change to page 2.
*
* TEST 2 RESULT:
* - works as expected: no error, and placed pdf graphic changes to page 2.
*
* NOTE: if TEST 1 works as expected for you, please run the test several times.
* Initially I had a more complicated version of the test, which failed, while this one passed,
* but it passed only once (if I remember right!) and thereafter failed, and now I can make it pass.
* So please test multiple times.
*/
function main() {
// set path to the same folder as this script
var path = File($.fileName).parent.fsName;
// open the demo indesign document
var doc1 = app.open(File(path + '/demo.indd'));
// the graphic we want to update
var graphic = doc1.allGraphics[0];
// we want to update to show artboard 2 (currently showing 1)
app.pdfPlacePreferences.pageNumber = 2;
try {
// here's where the problem occurs
graphic.place(File(graphic.itemLink.filePath), false);
} catch (error) {
alert(error);
}
};
app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, 'Test Graphic Update Bug');
So, the script just opens a document and attempts to update the graphic (by linking to another page in the same pdf). In my test, if I have the demo.indd document open already, it works fine and I see the graphic change to "SUCCESS". But if I let the script open the document, it fails. I would love to know your experience.
@Peter Kahrel you found the bug using link.update(). This has the same problem when I test it, but isn't as obvious for testing purposes because it doesn't throw an error (it just fails to update).
Thanks for your help. If I get some useful responses I will update the bug report with a link here and hopefully the developers will have something to get their teeth into. @amaarora you requested further information on this bug.
- Mark
1 Correct answer
Final update: it turns out that the error occurs due to a couple of preferences I had turned off. These guys:
So it does relate somewhat to the preferences I had turned off (don't remember turning them off, by the way—probably trying to speed up a huge document long ago). But given that the link in my demo file *wasn't missing*, I still consider this a bug and I will add a clarifying comment to the bug report Peter lodged.
Thanks everyone. Feel free to test again with "Find Missing Links Befo
...Copy link to clipboard
Copied
Hi Mark,
Tested on InDesign 18.2.1, on macOS 12.6.
TEST 1 A
1. Double clicked on the script and get prompted to update modified link.
2. Clicked Update Modified Links and link was updated and show page 2 of the PDF on page.
Ran the script multiple times and same got result.
TEST 1 B
1. Double clicked on the script and get prompted to update modified link.
2. Clicked Don't Update Links and link was still updated and show page 2 of the PDF on page.
TEST 2
1. Opened InDesign file and prompted to update link.
2. Update Modified Links and page 1 of PDF is shown on page.
Copy link to clipboard
Copied
Hi @Thunder-Lightning, thanks for trying the test. If you have time, I'll check a couple of things. When you open the .indd (without running the script) does it warn you that the graphic is modified? If so, please update (should still show FAILED), close and save document, and try script again. The placed item shouldn't be modified, so that may be wrecking the test. I don't expect or want Indesign to show any dialogs.
- Mark
Copy link to clipboard
Copied
Hi Mark,
I have done as you have outlined.
TEST 2B
1. Opened InDesign file and prompted to update link.
2. Update Modified Links and page 1 of PDF is shown on page.
3. Saved and closed InDesign file.
4. Ran script and the InDesign opened without any dialog box showing page 2 of the PDF placed.
Copy link to clipboard
Copied
Thanks @Thunder-Lightning, that is very clear. Sadly for me it means that this bug will be harder to pin down.
Copy link to clipboard
Copied
Works fine over here, Mark.
Windows 10/64, InDesign 18.3.0.50
Copy link to clipboard
Copied
Thanks @Peter Kahrel, so again this bug is being difficult to pin down! Frustrating because I get the error consistently, across restarts, different graphic files, different indesign files. For what it's worth, here's what I see:
Copy link to clipboard
Copied
Edit 2023-05-30: sorry all, false alarm, I discovered that it must be something relating to my Indesign install as it works fine on another install. No need for more testing.
Original post, please ignore:
@rob day, @Laubender, @Eugene Tyson, @Manan Joshi any chance any of you experts could have a look at this when you get a moment? I'm trying to find someone who is also experiencing this.
- Mark
Edit: especially anyone running MacOS 13, maybe on M1 chip?
Copy link to clipboard
Copied
UPDATE: I also have the Indesign 2023 pre-release installed, and I just tried it with that... and IT WORKED. So, that leads me to believe that it is a preference/settings issue with my normal Indesign install. I will troubleshoot. Hopefully I can pin down the specific cause. - Mark
Copy link to clipboard
Copied
Final update: it turns out that the error occurs due to a couple of preferences I had turned off. These guys:
So it does relate somewhat to the preferences I had turned off (don't remember turning them off, by the way—probably trying to speed up a huge document long ago). But given that the link in my demo file *wasn't missing*, I still consider this a bug and I will add a clarifying comment to the bug report Peter lodged.
Thanks everyone. Feel free to test again with "Find Missing Links Before Opening Documents" turned OFF, but I'm pretty confident that was it.
- Mark

