Copy link to clipboard
Copied
I am using inDesign 15.0.1. I have an indd file with thousands of single pages. On each page is a small PNG file which was placed into a frame using the Rectangle Frame Tool and Place.
When you look on the Layers tab, you see something similar to <myfile.png> for the object. I know I can manually click on it and change its name to something more descriptive, but I don't want to have to do this manually.
How can I write a script to go through all of the pages, and change the name? It will be the same name for all of the pages (even though the PNG file is different for every page).
Here is a small script, that renames all rectangles in the layer palette, if a .png file is placed.
var curDoc = app.activeDocument;
var curLinks = curDoc.links;
var NAME_IN_LAYER = "MyName";
for (var i=0; i<curLinks.length; i++) {
var curLink = curLinks[i];
var curLinkName = curLink.name;
if ( curLinkName.indexOf (".png") != -1) {
var curRectangle = curLink.parent.parent;
curRectangle.name = NAME_IN_LAYER;
}
}
Copy link to clipboard
Copied
I have no idea how to do this or if it's even possible. My question is why do you want to do this? Seems like an odd request.
Copy link to clipboard
Copied
Here is a small script, that renames all rectangles in the layer palette, if a .png file is placed.
var curDoc = app.activeDocument;
var curLinks = curDoc.links;
var NAME_IN_LAYER = "MyName";
for (var i=0; i<curLinks.length; i++) {
var curLink = curLinks[i];
var curLinkName = curLink.name;
if ( curLinkName.indexOf (".png") != -1) {
var curRectangle = curLink.parent.parent;
curRectangle.name = NAME_IN_LAYER;
}
}
Copy link to clipboard
Copied
Thank you !