Copy link to clipboard
Copied
I've been using this really simple script for a while:
if (app.documents.length == 0) alert("No documents are open. Please open a document and try again.");
var doc = app.activeDocument;
var links = doc.links;
for (var i = 0; i<links.length; i++) {
if (links[i].status == LinkStatus.LINK_MISSING) {
links[i].parent.remove();
}
}
It works perfectly well in versions CS6 to CC2021 (16.4), BUT in CC 2022 (17.0.1) it always throws an error:
Error Number: 55
Object does not support the property or method 'LINK MISSING'.
If checking the now deprecated ExtendScript Toolkit object model Viewer (in a Windows PC) and comparing it to the latest published API (sadly, only for CC 2021), there is a discrepancy. In CC2021, LinkStatus can have these values:
LinkStatus.LINK_EMBEDDED
LinkStatus.LINK_INACCESSIBLE
LinkStatus.LINK_MISSING
LinkStatus.LINK_OUT_OF_DATE
LinkStatus.NORMAL
BUT the Object Model Viewer in ESTK 4 shows a very different set of values:
LinStatus.DATASOURCE_UNAVAILABLE
LinkStatus.FIELD_UNAVAILABLE
LinkStatus.MARKED_AS_DELETED
LinkStatus.OK
LinkStatus.OUT_OF_DATE
LinkStatus.RECORD_UNAVAILABLE
Is it a bug or a feature? How can I now know the status of a link?
Found the "culprit": its EasyCatalog, a plug-in from 65bits that interferes with the LinkStatus included in InDesign! Uninstall EasyCatalog and everything works as expected.
Copy link to clipboard
Copied
Do you use this with InDesign or a different CC product (or more than one)?
Copy link to clipboard
Copied
Found the "culprit": its EasyCatalog, a plug-in from 65bits that interferes with the LinkStatus included in InDesign! Uninstall EasyCatalog and everything works as expected.
Copy link to clipboard
Copied
For more information: https://www.65bit.com/docs/scripting-support-for-links/