Skip to main content
Participant
November 21, 2011
Question

Relinking Images with different name

  • November 21, 2011
  • 1 reply
  • 1119 views

Hi

As a pre-press provider working with a large catalogue company who produce thier own files, we have problems with the Indesign files that they supply to us, in that the images linked in the document all have _FPO at the end of the filname. However the hires version, which we download does not, so the filenames do not match and the link will not automatically update. For example filename 12345_FPO is placed in the document, but the hires image is called 12345.tif. There can be up to 80 links in the document which all have to be swapped manually.

Does anyone know of a script or plug in which will exclude the last 'so many' characters of a filename when re-linking?

Any help would be greatly appreciated!

Danny

This topic has been closed for replies.

1 reply

Jongware
Community Expert
Community Expert
November 21, 2011

You can adjust this last week's script that examines image names and relinks them after some manipulation:

need to relink missing links to files with extensions

-- all you have to do is strip off the "_FPO", test if this file actually exists (I'd recommend that extra step), and if so relink.

Jongware
Community Expert
Community Expert
November 21, 2011

Here you go. Worked just fine & dandy with the one test file I created.

doc = app.activeDocument;

imgs = doc.links;

path = doc.filePath;

for (i=0; i<imgs.length; i++)

{

          // Missing?

          if (imgs.status == LinkStatus.LINK_MISSING)

          {

                    // Is this an FPO one?

                    if (imgs.name.match ("_FPO\."))

                    {

                              // Remove 'FPO'

                              newName = imgs.name.replace ("_FPO\.", ".");

                       //       alert (newName);

                              // Do we have a file?

                              imglist = Folder(File(imgs.filePath).path).getFiles (newName);

                              if (imglist.length == 1)

                              {

                                        // Oh yeah

                                        imgs.relink(imglist[0]);

                              }

                    }

          }

}

Message was edited by: [Jongware] No need for a continuous alert popping up :)

Known Participant
September 13, 2022

Fantastic!

Thank you i will test it out later......... Thanks ever so much for

looking into this for me, i will let you know how i get on..............


doc = app.activeDocument;

imgs = doc.links;

path = doc.filePath;

for (i=0; i<imgs.length; i++)

{

// Missing?

if (imgs.status == LinkStatus.LINK_MISSING)

{

// Is this an FPO one?

if (imgs.name.match ("_NOT FINAL\."))

{

// Remove 'FPO'

newName = imgs.name.replace ("\.", ".");

// alert (newName);

// Do we have a file?

imglist = Folder(File(imgs.filePath).path).getFiles (newName);

if (imglist.length == 1)

{

// Oh yeah

imgs.relink(imglist[0]);

}

}

}

}