Reply To: Simple relink script help!

#60787
ivan_
Member

Thank you Kasyan, your help is greatly appreciated.

The directory slashes seem to happen when copying and pasting from extendscript to the forum, it also seems to change the script 'i–'.

Would it be possible to talk me through the script and its actions. This is as how I understand it:

#target indesign = targets indesign application
var i, link, newFile, = specifies variables


doc = app.activeDocument, = specifies the active document as the file name
links = doc.links, = name of all the links in the file
newPath = “/c/temp/newproject/”; = new path string

for (i = links.length-1; i >= 0; i–) { = loops through each link in links from 0 to infinity
link = links[i]; = each link in the loop is a seperate string
newFile = new File(newPath + link.name); =concatenates path and file name to create new file
if (newFile.exists) link.relink(newFile); = loops throguh and relinks files
try {
link.update(); = update links
}
catch(err) {}
}

Was just wondering why you have to use 'try { }' and 'cath(err){}'.

Regards,

Iv

This article was last modified on October 17, 2011

Comments (0)

Loading comments...