3 Replies Latest reply on Jun 11, 2010 2:53 AM by Kasyan Servetsky

    Batch relink images in InDesign CS4

    Alexander Scherling

      Hi all your InDesign wizkids.

       

      I have a document with 800 image links that all have changed location and filename.

       

      all instances have a product number as filename. They have now been changed.

       

      so filename was eg. changed from --> to:

       

      123456.tif  -->  1203456.tif

      112233GB.tif  --> 1102233GB.tif

      79657.tif     -->     790657.tif

      13657NHZ.tif -->     130657NHZ.tif

       

      The only change is that there have been added a 0 as third digit.

       

      Also it would be cool to update path in same action to some/new/folder/to/file

       

      It would be a major help if any one could solve this.

       

      Best regards

       

      Alexander

        • 1. Re: Batch relink images in InDesign CS4
          brettpolo

          Should be very easy to do if the only diffrence is that there is a '0' inserted after the second character...

           

          something like the following should work:

           

          newPath = "/your/new/path/here"
          myLinks = app.activeDocument.links
          
          for (i = 0; i < myLinks.length; i++){
               var oldName = myLinks[i].name;
               var newName = oldName.slice(0,2) + "0" + oldName.slice(2);
               myLinks[i].relink(newPath+newName)
               }
          

           

          replace 'newPath' with the path the new links will be in.

          • 2. Re: Batch relink images in InDesign CS4
            Alexander Scherling Level 1

            Thanks a lot.. it looks really good, but doesn't seem to work..

             

            The ExtendScript toolkit just keeps running (15 min) on a test doc i made with 20 links.

             

            What is wrong?

             

            Was it possible to make script without relink, so i just do that from the linkspalette??

             

            Here is script:

             

            newPath = "smb://sql-srv/marketing$/Marketing/TOOLBOX/Pictures/PACKSHOTS/Charms/TIFF CMYK/"

            myLinks = app.activeDocument.links

             

             

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

                 var oldName = myLinks[i].name;

                 var newName = oldName.slice(0,2) + "0" + oldName.slice(2);

                 myLinks[i].relink(newPath+newName)

                 }

            • 3. Re: Batch relink images in InDesign CS4
              Kasyan Servetsky Level 5

              Try to set newPath variable like so:

               

              var newPath = "/Volumes/sql-srv/marketing$/Marketing/TOOLBOX/Pictures/PACKSHOTS/Charms/TIFF CMYK/";
              

              I assume that sql-srv is a mounted volume on your desktop.

               

              Kasyan