3 Replies Latest reply on Mar 3, 2008 4:47 PM by Eric @ MCA

    automate updating of broken links?

      I was wondering if there was any way to script changing the UNC
      pathnames of linked files in an Indesign CS2 document.

      We recently migrated to different servers, and the paths to our files
      have changed.

      Originaly: \\WTW\PGH & \\WTWGRAPHICS2\GRAPHICS

      Changed to \\wtw-file\wtw\pgh & \\wtw-file\wtwgraphics\graphics

      This caused a big problem with our indesign files - very long delays
      opening up the files. Apparently ID is trying to locate the old server,
      and it makes it very difficult to work with (and more importantly, to
      meet deadlines).

      I don't know anything about ID scripting, it's all new to me, so I
      would apreciate any advice offered.

      Jim Helfer
      WTW Architects
        • 1. Re: automate updating of broken links?
          Peter Kahrel Adobe Community Professional & MVP
          Jim,

          I have used this script to update path names in links:

          new_path = '/d/temp/'
          imgs = app.activeDocument.allGraphics
          for (i = 0; i < imgs.length; i++)
          {
          img = imgs[i].itemLink
          img.relink (File (new_path + img.name))
          img.update()
          }

          Just enter the name of the new path after new_path.

          Peter
          • 2. Re: automate updating of broken links?
            Level 1
            Thanks! But, this may not work for us. The "newpath" could be one of
            two options. (We have a folder organization system that sometimes gets
            complex).

            Jim Helfer
            WTW Architects
            • 3. Re: automate updating of broken links?
              Eric @ MCA Level 3
              Ask them to choose a folder themselves and then try to relink all missing graphics against that new folder. That's how I do it.

              Also, it's flexible no matter what weird situation the users come up with. The only gotcha I am aware of is if you somehow have bad and good graphics mixed in the same folder, in which case it will update both the good and the bad graphic links successfully.

              I work in Applescript, but it's something like:
              set missingLinks to id of every link whose status = link missing
              set chosenFolder to choose folder with prompt "Choose the folder you wish to try to relink to:"
              repeat with thisLinkID in missingLinks
              try
              set thisLink to item 1 of (every link whose id = thisLinkID)
              relink thisLink to (chosenFolder & name of thisLink) as string
              on error
              --do nothing
              end try
              end repeat