4 Replies Latest reply on Jul 16, 2015 9:39 AM by KuddRoww

    Missing Links

    KuddRoww Level 1

      I'm trying to find a way to get the links and link statuses in Adobe Illustrator. It doesn't seem to be at all similar to InDesign DOM so I'm hoping somebody has done a similar thing before.

       

      What I'd like to be able to do is check whether a file has a missing link. I have been able to trace it to a "placedItem" which is inherently a "pageItem". So is it possible to find the link status? Been going through the DOM for about a half hour now and still can't find it.

       

       

      app.documents[0].placedItems[0]  <--- How to get link status?

       

      Thanks!

        • 1. Re: Missing Links
          KuddRoww Level 1

          folder = Folder.selectDialog();

          files = folder.getFiles("*.ai");

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

              var myDoc = app.open(files[i]);

              if(myDoc.placedItems.length>0){doStuff()};

              myDoc.close();

              }

          That's the best that I could come up with for now. Whether or not that particular placed item is linked or not I have no way to confirm... but it gets me close enough for my workflow. It would be nice if the links had a status.

          • 2. Re: Missing Links
            Muppet Mark Level 5

            In AI you could look at the rasterItemStatus or make use of the objects file property to validate the existance… The latter is possible before opening the file by parsing the links out of the file…

            • 3. Re: Missing Links
              suneelkv Level 1

              I tried this piece of code to print the rasterItemStatus, but it is printing as undefined... any help is appreciated?

               

               

               

              function getFileName()

              {

                     for (var i = 0, l = doc.artboards.length; i < l; i++)

                     {

                          doc.artboards.setActiveArtboardIndex(i); 

                          doc.selectObjectsOnActiveArtboard(); 

                          for (var iSelectedItems=0; iSelectedItems<doc.rasterItems.length; iSelectedItems++)

                                 {

                                           var topLeftPosDoc= doc.rasterItems[iSelectedItems].position;   

                                           //if (doc.rasterItems[iSelectedItems].file.name)

                                           //{

                                              $.writeln("doc.rasterItems[iSelectedItems] rasterItemStatus  ::: ",doc.rasterItems[iSelectedItems].rasterItemStatus);

                                  }

                      }

              }

              • 4. Re: Missing Links
                KuddRoww Level 1

                The latest DOM doesn't show a rasterItemStatus, however there is a status property. Maybe amend your code to: $.writeln("doc.rasterItems[iSelectedItems] rasterItemStatus = doc.rasterItems[iSelectedItems].status