10 Replies Latest reply on Dec 11, 2013 7:04 AM by CambLSAT

    Change specific link path across documents.

    CambLSAT

      I'm writing a simple script to change the path for a number of links across multiple documents. I'm getting a 'filePath is a read only property' error for line 7, even though I'm not trying to rewrite it directly. Any help would be greatly appreciated. Thanks!

       

      var myDocument = app.activeDocument;
      var oldPath = "G:\\Users\\My PC\\Desktop\\";
      var newPath = "G:\\Users\\My PC\\Desktop\\New Folder\\";
      for (a=0; a < myDocument.links.length; a++) {
          var currentLink = myDocument.links[a];
          var linkName = currentLink.name;
          if (currentLink.filePath = oldPath) {
              var myNewFile = new File(newPath + linkName);
              currentLink.relink(myNewFile);
              };
          };