Fixing missed links using Tree Shade extension

I have developed Tree Shade as a CEP extension for InDesign. One of its feature is fixing the missed links using the special IDs records stored by the extension for Adobe Bridge.
I get a feedback from a user that he has nested InDesign documents and this feature is not working.
Is there a property that check if the placed InDesign document has missed links or not? Because I want to check before executing commands for opening the nested ones to update their links.
And is there nesting hierarchy for scanning the links?

LinkStatus.LINK_EMBEDDED
LinkStatus.LINK_INACCESSIBLE
LinkStatus.LINK_MISSING
LinkStatus.LINK_OUT_OF_DATE
LinkStatus.NORMAL

Links in a placed InDesign file cannot be seen unless you open the InDesign document.

I’m thinking the same thing.
In an ExtendScript project, I place Adobe InDesign documents in other Adobe InDesign documents to allow the equivalent of two people to work on parts of the same document. This is for jumping articles in newspapers. And I don’t recall having any way to check the links in the placed Adobe InDesign document.
One weird thing, is if you do that, and you interrogate Adobe InDesign about its open documents, you’ll see that Adobe InDesign has an open version of the placed document. There’s no layout window and thus nothing for the user to see, but it’s there. So you might not have to physically open the placed file. You might be able to look at all of the currently open documents, infer that one is the placed document, and check the links.

jsw

The path to the link file is written in the XMP metadata of the indd file, so perhaps you can refer to that to check if it is invalid yourself.

Tried it and the path to the link images in the indd placed as a link also existed.

Thanks for all your replies.
I found that there is a property for link object called “links”. Its length is zero except for nested InDesign as a link, then it will has the links in that document.

function checkNestedMissingLinks() {
    var doc = app.activeDocument;
    var links = doc.links;
    var isAllUpdated = true;
    for (var i = 0; i < links.length; i++) {
        if (links[i].links.length > 0) {
            if (links[i].linkType == "InDesign Format Name") {
                for (var ii = 0; ii < links[i].links.length; ii++) {
                    if (links[i].links[ii].status == LinkStatus.LINK_MISSING || links[i].links[ii].status == LinkStatus.LINK_OUT_OF_DATE) {
                        isAllUpdated = false;
                        //Write you code here
                        
                        break;
                    }
                }
            }
        }
    }
    return isAllUpdated;
}
1 Like

Awesome sleuthing, @dulajun!

1 Like