Skip to main content
Inspiring
October 17, 2022
Question

type of link is .doc doc.links.everyItem().update(); not work

  • October 17, 2022
  • 3 replies
  • 585 views

hi this function on app.activedocument

			doc.links.everyItem().update();
			doc.save();

 

 

it  not work my only link into indd file is .doc

 

thanks in advance

This topic has been closed for replies.

3 replies

Community Expert
October 17, 2022

Some pertinent questione would be

  • How did you conclude that it's not working. Do you get any errors?
  • Does this happen with only this doc link or all the links in this file.
  • How about executing this code on another INDD file, what happens in that case?

-Manan

-Manan
Inspiring
October 17, 2022

visual code stop (wait the video is uploaded) 

doc.links.everyItem().update();

Exception has occurred: 35842
  • missing link 
Loic.Aigon
Legend
October 17, 2022

Your issue is that link is actually missing (interrogation mark in red dot). So you are asking InDesign to update a link it just doesn't reach. Hence the failure.

 

If you can access the resource, you need to relink() and not update().

 

Otherwise, you are hitting a wall.

Loic.Aigon
Legend
October 17, 2022

Totally working on my side. Which InDesign version are you running? 

Inspiring
October 17, 2022

on the last 2022 i will try to do a video

Inspiring
October 17, 2022

sorry i forget an information, error appear if only link is .doc AND this link is missing 

https://youtu.be/UL5IQOABSiw

Community Expert
October 17, 2022

Hi @laurence roussel12011930 ,

your code should work for all placed and linked images.

 

You could also test something else:

// Create an array of all links of the document:
var allLinks = app.documents[0].links.everyItem().getElements();

// Loop the array:
for( var n=0; n<allLinks.length; n++ )
{
allLinks[n].update();
};

 

Or use relink(File) in the loop.

So you do a relink to the same file:

// Create an array of all links of the document:
var allLinks = app.documents[0].links.everyItem().getElements();

// Loop the array:
for( var n=0; n<allLinks.length; n++ )
{
allLinks[n].relink( allLinks[n].filePath );
};

 

Regards,
Uwe Laubender
( Adobe Community Expert )