Copy link to clipboard
Copied
Hi all,
I produce books with indesign that often have hundreds of pages and even more images.
It happens that I accidentally use the same image twice.
I am looking for a way to search my links to see if there are unwanted duplicates.
Any ideas, scripts which might help?
Look into the link panel, any image that is used multiple times is grouped and shown that is used multiple times.
This is a bit crude - just trying to see if it works for you
It will create a text file on your desktop listing the images that are duplicated and what pages they are on
var allLinks = app.activeDocument.links;
var imageLinks = {};
for (var i = 0; i < allLinks.length; i++) {
var linkName = allLinks[i].name;
var parentObj = allLinks[i].parent;
var pageNum = parentObj.parentPage.name;
if (!imageLinks[linkName]) {
imageLinks[linkName] = [pageNum];
} else {
imageLinks[linkName]
...
Copy link to clipboard
Copied
Look into the link panel, any image that is used multiple times is grouped and shown that is used multiple times.
Copy link to clipboard
Copied
Thanks much!
Copy link to clipboard
Copied
This is a bit crude - just trying to see if it works for you
It will create a text file on your desktop listing the images that are duplicated and what pages they are on
var allLinks = app.activeDocument.links;
var imageLinks = {};
for (var i = 0; i < allLinks.length; i++) {
var linkName = allLinks[i].name;
var parentObj = allLinks[i].parent;
var pageNum = parentObj.parentPage.name;
if (!imageLinks[linkName]) {
imageLinks[linkName] = [pageNum];
} else {
imageLinks[linkName].push(pageNum);
}
}
var file = new File("~/Desktop/image_links.txt");
file.open("w");
for (var linkName in imageLinks) {
if (imageLinks[linkName].length > 1) {
file.writeln(linkName + ': Pages ' + imageLinks[linkName].join(', '));
} else {
file.writeln(linkName);
}
}
file.close();
alert('Image links have been saved to the file "image_links.txt" on your desktop.');
Copy link to clipboard
Copied
Thanks much!