Highlighted

Image Link with hidden layer images

Participant ,
Sep 24, 2020

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;
        }

 

Adobe Community Professional
Correct answer by brianp311 | Adobe Community Professional

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). 

 

TOPICS
Scripting

Views

58

Likes

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

Image Link with hidden layer images

Participant ,
Sep 24, 2020

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;
        }

 

Adobe Community Professional
Correct answer by brianp311 | Adobe Community Professional

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). 

 

TOPICS
Scripting

Views

59

Likes

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
Sep 24, 2020 0
Adobe Community Professional ,
Sep 24, 2020

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). 

 

Likes

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
Reply
Loading...
Sep 24, 2020 2