0 Replies Latest reply on Jun 16, 2010 11:23 AM by jhhtz

    Help - InDesign CS2 Relink Script

    jhhtz

      We recently updated our storage solution from two external hard drives to a large, single volume. As a result, all of the links in our InDesign documents are now broken. Links that used to point to...

       

      /Volumes/Raid1/.../link.pdf

      /Volumes/320GB/.../link.pdf

       

      ... should now point to...

       

      /Volumes/Drobo/RAID1/.../link.pdf

      /Volumes/Drobo/RAID2/.../link.pdf

       

      I wrote a script that automatically fixes all of the old links. It runs fine in CS4. Unfortunately, we have 300+ CS2 documents that we only access from CS2 workstations, and the script is not working there.

       

      The script is below, and a screen capture of the CS2's error is below that. Any advice would be tremendously appreciated.

       

      var allLinks = app.documents[0].links;
      for (i = 0; i < allLinks.length; i++) {
           var thisLink = allLinks[i];
           var thisLinkPath = thisLink.filePath;
           var newLinkPath = thisLinkPath;
           if (thisLinkPath.substring(0,14) == '/Volumes/Raid1') {
                newLinkPath = thisLinkPath.replace(/\/Volumes\/Raid1/g, '/Volumes/Drobo/RAID1');
           } else if (thisLinkPath.substring(0,14) == '/Volumes/320GB') {
                newLinkPath = thisLinkPath.replace(/\/Volumes\/320GB/g, '/Volumes/Drobo/RAID2');
           } else      if (thisLinkPath.substring(0,5) == 'Raid1:') {
                newLinkPath = thisLinkPath.replace(/Raid1:/g, 'Drobo:RAID1:');
           } else if (thisLinkPath.substring(0,5) == '320GB:') {
                newLinkPath = thisLinkPath.replace(/320GB:/g, 'Drobo:RAID2:');
           }
           var newFile = new File(newLinkPath);
           thisLink.relink(newFile);
           thisLink.update();
      }
      

       

      Picture 1.png