• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

Explorer ,
Oct 17, 2022 Oct 17, 2022

Copy link to clipboard

Copied

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

TOPICS
Scripting

Views

197

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 17, 2022 Oct 17, 2022

Copy link to clipboard

Copied

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 )

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Oct 17, 2022 Oct 17, 2022

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 17, 2022 Oct 17, 2022

Copy link to clipboard

Copied

on the last 2022 i will try to do a video

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 17, 2022 Oct 17, 2022

Copy link to clipboard

Copied

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

https://youtu.be/UL5IQOABSiw

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 17, 2022 Oct 17, 2022

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 17, 2022 Oct 17, 2022

Copy link to clipboard

Copied

visual code stop (wait the video is uploaded) 

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

Exception has occurred: 35842
  • missing link 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Oct 17, 2022 Oct 17, 2022

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 17, 2022 Oct 17, 2022

Copy link to clipboard

Copied

		    if (internal_link[k].status == LinkStatus.LINK_MISSING){
			    var folderPath = (File.openDialog(internal_link[k].filePath));
			    var imglist = Folder(folderPath).getFiles(internal_link[k].name+".*");
			    if (imglist.length == 1){
				internal_link[k].relink(imglist[0]);
			    }
		    }
			else {
					doc.links.everyItem().update();
					doc.save();
			}

 

but 

			    var imglist = Folder(folderPath).getFiles(internal_link[k].name+".*");

 

visual code tell than  folder().getfiles is not a function

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Oct 17, 2022 Oct 17, 2022

Copy link to clipboard

Copied

[EDIT]discard answer, can't remove message[/EDIT]

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Oct 17, 2022 Oct 17, 2022

Copy link to clipboard

Copied

Why the use of getFiles anyway? If you know file location, just use a File object => .relink(File(linkPath));

Obviously check for File(linkPath).exists first.

Loic

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 17, 2022 Oct 17, 2022

Copy link to clipboard

Copied

Hi @Loic.Aigon,

I have been having this discussion with @laurence roussel12011930 on the code snippet he shared in his last post. It's difficult to understand what he is trying to achieve but do go through the discussion so far on the other thread. Probably I am missing something and you might be able to add in something that leads him to a solution

https://community.adobe.com/t5/indesign-discussions/function-getfiles-for-file-and-not-for-folder/m-...

-Manan

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Oct 17, 2022 Oct 17, 2022

Copy link to clipboard

Copied

Indeed, it reminds me at my early stage where every line of code was a questioning 🙂

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 17, 2022 Oct 17, 2022

Copy link to clipboard

Copied

LATEST

exactly

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 17, 2022 Oct 17, 2022

Copy link to clipboard

Copied

because someone write me that.... ^^

 

if link is missing, we open a dial windows for choose the  good file for replace, mean we will replace the oldfile path by new choosed

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines