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

Alert display on missing links

Explorer ,
Mar 05, 2019 Mar 05, 2019

Hi

I am using link replacer script for linking the linked images but I need to display the all the missing links in one alert display.

#target illustrator 

 

function linkReplacer() { 

     var orginalUIL = app.userInteractionLevel; 

     app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS; 

     if (app.documents.length == 0) { 

          alert('Please have an "Illustrator" document open before running this script.'); 

          return; 

     } else { 

          docRef = app.activeDocument; 

     } 

        

     var defaultFolder = new Folder (Folder(app.activeDocument.path + '/../040 Images/043 High Res')); 

     var psdFolder = defaultFolder; 

     if (psdFolder == null) return; 

      

     with (docRef) { 

          var placedFiles = new Array(); 

          for (var i = 0; i < placedItems.length; i++) { 

               placedFiles.push(placedItems.file.name); 

          } 

           

          for (var j = 0; j < placedItems.length; j++) { 

               var rePlace = new File(psdFolder.fsName + '/' + placedFiles); 

               if (rePlace.exists) { 

                    placedItems.file = rePlace; 

               } else { 

                    alert('File "' + placedFiles + '" is missing?'); 

               } 

          } 

     } 

     app.userInteractionLevel = orginalUIL; 

 

linkReplacer();

TOPICS
Scripting
879
Translate
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

correct answers 1 Correct answer

Community Expert , Mar 06, 2019 Mar 06, 2019

declare an array (in the example below i'm calling it missingLinks) at the top of the script to hold the names of the files. then replace this line:

alert('File "' + placedFiles + '" is missing?');

with this

missingLinks.push(placedFiles);

then do your alert at the bottom of the script, like so:

if(missingLinks.length)

{

     alert("The following liinks are missing:\n" + missingLinks.join("\n"));

}

Translate
Adobe
Community Expert ,
Mar 06, 2019 Mar 06, 2019

declare an array (in the example below i'm calling it missingLinks) at the top of the script to hold the names of the files. then replace this line:

alert('File "' + placedFiles + '" is missing?');

with this

missingLinks.push(placedFiles);

then do your alert at the bottom of the script, like so:

if(missingLinks.length)

{

     alert("The following liinks are missing:\n" + missingLinks.join("\n"));

}

Translate
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 ,
Mar 06, 2019 Mar 06, 2019
LATEST

Thanks it is working good and helpful..

Translate
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