Copy link to clipboard
Copied
Hi everyone,
I could not able to relink the images due to Internal Linked story in the link palette. I try to ignore and run the script it wont work. Could anyone help me out from this.
linksDetails is an array I stored the multiple folder path for relink.
doc = app.activeDocument;
var LinksDoc = [];
var myLinks = doc.links;
var saveDoc = false;
if(myLinks.length>0){
for(a=0; a<myLinks.length; a++){
if(myLinks[a].linkType != "Internal Linked Story" || myLinks[a].linkType != "Internal Linked Object"){
var singleImages = String(linksDetails).split(",");
for(b=0; b<singleImages.length; b++){
alert(myLinks[a].name);
if(singleImages[b].search(myLinks[a].name) > 0) {
myLinks[a].show();
var newLinkPath = File(singleImages[b]);
myLinks[a].relink(newLinkPath);
saveDoc = true;
break;
}
}
}
saveDoc = true;
}
Copy link to clipboard
Copied
How is it not working? Does it throw an error?
First thing is to wrap everything within your for block in a try/catch statement. This will skip through any errors.
Secondly, String.search is not available in ExtendScript. Use String.indexOf instead (>= 0, since 0 would return the start of the string).