5 Replies Latest reply on Jan 23, 2012 12:46 PM by KuddRoww

    How to change a link (new name) in Indesign with 75 documents

    Romano van Hertrooij

      Hello readers

       

      This is my problem i have 75 indesign documents with different sizes named >>> Winter 2011 120cmx200cm, Winter 2011 200cmx225cm etc etc)

      Renaming is not a problem in Bridge changing Winter 2011 into Spring 2012

      But i want to change the imported foto "Winter.eps" into "Spring.eps" and i want to do it quickly because i have to update 35 series of 75 documents

       

      Greetings Romano

        • 2. Re: How to change a link (new name) in Indesign with 75 documents
          richardh6 Level 1

          If they're placed simply in rectangles on pages (not embedded in text or anything else), something like this ought to  work:

           

           

          var docNum, spreadNum, rectNum;
          var doc, spread, img;
          
          for (docNum = 0; docNum < app.documents.length; docNum += 1) {
            doc = app.documents[docNum];
            for (spreadNum = 0; spreadNum < doc.spreads.length; spreadNum += 1) {
              spread = doc.spreads[spreadNum];
              for (rectNum = 0; rectNum  < spread.rectangles.length; rectNum += 1) {
                img = spread.rectangles[rectNum].images[0];
                if (img.itemLink.name === '<your old file name>') {
                  img.place( '<new file path>' );
                }
              }
            }
          }
          

           

          Make sure you get the file path exactly right. That can be tricky.

          • 3. Re: How to change a link (new name) in Indesign with 75 documents
            John Hawkinson Level 5
            Make sure you get the file path exactly right. That can be tricky.

            It's a good idea, in scripts like this, to operate based on the selection (for the image name), and to prompt the user for the new file path with File.openDialog().

            • 4. Re: How to change a link (new name) in Indesign with 75 documents
              richardh6 Level 1

              I definitely agree with you, John, about prompting for the new file path.

               

              As for the old image name, he wants to do a batch process on many documents, so he could have the user select one of the copies of the image and search for all the others, or he could just prompt the user for the old name, or even do File.openDialog() to get a reference to the old image.

               

              And of course, if there's really a lot of documents, he might want to have the script recursively open all the documents in a particular folder and all its subfolders, process them, and then save them and close them.

              • 5. Re: How to change a link (new name) in Indesign with 75 documents
                KuddRoww Level 1

                I had to do a similar thing.

                 

                The script above doesn't really seem to suit your need (I can't get it to work and I've given up trying, seems to me that it can't find image ) given that it would require you to select each file, which isn't any quicker than simply changing it within the file yourself. Anyways for lack of an actual script to do this I just did a conversion to IDML. I then did a Search and Replace through all of the IDML files with Oxygen XML on the part of the link I wanted to change (I had to change file names as well as some paths). The end result is I was able to change all of the links on a 500 file set in a couple of hours.

                 

                The part that takes the longest is switching from IDML to INDD.

                 

                So if you need a quick fix until someone can come up with an actual solution to your problem you could try that.