Mobile app version of vmapp.org
Login or Join
Vandalay110

: InDesign relink - same files (size, extension), but different name I was given an InDesign file with links that are in Korean language. The original file names mostly use Korean symbols, but

@Vandalay110

Posted in: #AdobeIndesign

I was given an InDesign file with links that are in Korean language.
The original file names mostly use Korean symbols, but the files I have were all renamed. Here is an example:


%#@$.psd
(please understand the #%#$ as Korean symbols, the website does not allow me to use them in the body)



original file name. Thats how I see it in the links panel in InDesign



_____.psd



that is how the files were somehow automatically renamed before I got them.


So, all symbols in Korean are replaced with a "_".
Files are the same size and extension, but are not recognized because of the name.

Is there some trick to do it faster than 1 by 1. Doing them 1 by 1, I have just the file size as reference and it will take ages (200+ links).

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Vandalay110

1 Comments

Sorted by latest first Latest Oldest Best

 

@Radia289

This can be done with an automated script. You must point it to the right folder to read the images from, the rest can be done automatically.

InDesign stores not only the name of linked files into your document, but also lots more – see the JavaScript Reference for Link for a full list. Since size is among these, this script can locate candidates, and automatically replace it if there is only one. For safety measures, it checks if the file has the same file extension as well (and for this to work, it ignores case differences). The file is only replaced when there is exactly one candidate, so check the Linked Files list after running for left-overs.

The script first asks from which folder it should read the images from; the default is the folder containing the InDesign document, but you can navigate elsewhere as well.

The following is a JavaScript, so save as findLostImages.jsx into your User Scripts folder. Then run it by double-clicking in your Scripts panel.

Run this on a saved copy of your original InDesign document. Due to the specific nature of this request, I could not thoroughly test it, and so if things go awry you'll be happy to have a backup.

//DESCRIPTION:Find lost images by size
// A Rad Lexus Script 31-Jul-2016

if (!app.documents.length)
{
alert ('please open a document first');
exit();
}

problems = [];

path = Folder(app.activeDocument.filePath).selectDlg("Select file source");
if (path)
{
// load the images in this folder
filelist = path.getFiles ('*.*');
// alert (filelist);

// loop over the images
for (i=0; i<app.activeDocument.allGraphics.length; i++)
{
// is it a linked file?
if (app.activeDocument.allGraphics[i].itemLink &&
app.activeDocument.allGraphics[i].itemLink.needed)
{
size = app.activeDocument.allGraphics[i].itemLink.size;
extension = app.activeDocument.allGraphics[i].itemLink.filePath.substring
(app.activeDocument.allGraphics[i].itemLink.filePath.lastIndexOf('.')).toLowerCase();
// check our list
matches = [];
for (j=0; j<filelist.length; j++)
{
// extension the same?
if (extension.localeCompare(filelist[j].fullName.substring
(filelist[j].fullName.lastIndexOf('.')).toLowerCase()) == 0)
{
// size the same?
if (filelist[j].length == size)
matches.push (filelist[j]);
}
}
// did we find a match?
if (matches.length == 1)
{
app.activeDocument.allGraphics[i].itemLink.relink (matches[0]);
} else
{
if (matches.length == 0)
problems.push ('no match for '+app.activeDocument.allGraphics[i].itemLink.filePath);
else
problems.push ('multiple matches for '+app.activeDocument.allGraphics[i].itemLink.filePath);
}
}
}
if (problems.length)
alert (problems.join('r'), 'Problems');
}

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme