Skip to main content
_wckdTall_
Inspiring
Feb 12, 2026 1:19 AM UTC
Answered

InDesign Scripting use .reinitLink() Change missing link status to modified

I’m trying to relink files in a document without updating them so I can review them 1 by 1.

I have successfully used  .reinitLink() on a mac, but It won’t update the link status until I reopen the document. I have been able to test sucessfully with .relink, but I don’t want it to update automatically.

Example

var pathVar = "/FullPathToAsset/"
app.activeDocument.links[0].reinitLink("file:"+pathVar)

I tried using links[0].update() after reinitLink
But nothing happens. Is there a way to check links after these updates are made?

    _wckdTall_
    _wckdTall_Correct answer
    Inspiring
    Feb 18, 2026 7:51 PM UTC

    ​@leo.r Turns out, It was a formatting thing. When I’m pulling the file paths initially, it uses a home directory path:
    ~/Desktop/Path_To_Files.psd

    It appears, reinitLink needs the a linkResourceURI, which can be corrected by passing the string path to File(), prepending “file:/”(as the path includes a leading slash already) and extracting the fsName.

    app.activeDocument.links[0].reinitLink("file:/"+File("~/Desktop/pathToFile.psd").fsName)


    Haven’t needed decodeURLComponent, switches to modified right away!
     

    7 replies

    leo.r
    Community Expert
    Community Expert
    Feb 12, 2026 5:38 AM UTC

    Do I understand correctly that you want the status of the link to be “modified” after you relink it?

     

    If so then you can do something to force it to appear modified. For example, send it the touch shell command (albeit it’ll change its modification date; the command has all kinds of options though). Or write some metadata to the file. (It’s possible there are simpler ways I didn’t think of.)

     

     

    Translate
    _wckdTall_
    Inspiring
    Feb 13, 2026 4:35 PM UTC

    Yes, I the status should be “modified”. In many cases I’m changing the link, the path updates correctly, and the file size goes to zero in the links panel. I want to trigger InDesign to refresh the link info, assuming link status will change. 

    Translate
    leo.r
    Community Expert
    Community Expert
    Feb 13, 2026 7:25 PM UTC

    Then you can use the methods I mentioned above.

     

    As to the “file size goes to zero in the links panel” problem, I’ve never seen this before. Do you get this when using the relink method? (I don’t know much about the reinitLink function. It’s labeled “experimental”, I only tested it briefly with mixed results and never used for any practical purpose.)

    Translate