Reply To: Simple relink script help!

#60776

Hi Ivan,

It doesn't work because you made too many mistakes in your code.

#target indesign
var i, link, newFile,
doc = app.activeDocument,
links = doc.links,
newPath = “/c/temp/newproject/”;

for (i = links.length-1; i >= 0; i–) {
link = links[i];
newFile = new File(newPath + link.name);
if (newFile.exists) link.relink(newFile);
try {
link.update();
}
catch(err) {}
}

BTW if you want to use Windows path names, you should escape backslashes:

newPath = 'c:tempnewproject';

I prefer URI path names:

newPath = “/c/temp/newproject/”;

Hope this helps.

Kasyan

P.S. I don't hang out on Adobe forums any more because they blocked access from my country. If you have more questions to me about scripting links (it's quite a tricky business), feel free to ask them here.

This article was last modified on October 15, 2011

Comments (0)

Loading comments...