Copy link to clipboard
Copied
Hello,
I would like to ask if someone know script that allows to rename "<polygon>, <line>" (as on screen below) etc. inside layer to wanted name?
I have a lot of names that needs to be changed, and changing it manually is a bit of a pain.
I know script that can change layer name, but it does not work on the "sub layers" (I know INDD does not have sub layers, but I just want to make clear what I'm talking about),
Please help!
The items listed in a layer's drop down are the active page's page items and a page item can be named via scripting. This example names all of the active page's items with the item's id followed by "My Name".
var n="My Name"
var p=app.activeWindow.activePage.allPageItems;
for (var i = 0; i < p.length; i++){
p.name=p.id + "-" + n;
};
Or it could be the selected items
...var n="New Name"
//var p=app.activeWindow.activePage.allPageItems;
var p=app.activeDocument.selection;
for (var i = 0; i < p.length;
Copy link to clipboard
Copied
Hi,
are these layer elements polygons, that you created in InDesign?
Copy link to clipboard
Copied
The items listed in a layer's drop down are the active page's page items and a page item can be named via scripting. This example names all of the active page's items with the item's id followed by "My Name".
var n="My Name"
var p=app.activeWindow.activePage.allPageItems;
for (var i = 0; i < p.length; i++){
p.name=p.id + "-" + n;
};
Or it could be the selected items
var n="New Name"
//var p=app.activeWindow.activePage.allPageItems;
var p=app.activeDocument.selection;
for (var i = 0; i < p.length; i++){
p.name=p.id + "-" + n;
};
Copy link to clipboard
Copied
Hello,
You are my star rob day.
I have changed one string only:
var n="mynana"
//var p=app.activeWindow.activePage.allPageItems;
var p=app.activeDocument.selection;
for (var i = 0; i < p.length; i++){
p.name= n; over here, so I get only word that I need inserted on marked layer.
};
Thanks!!!!
Copy link to clipboard
Copied
If you need a dialog for the name try this:
var d = app.dialogs.add({name:"Item Names"});
var tf = d.dialogColumns.add().textEditboxes.add({editContents:"", minWidth:180});
d.show();
var n = tf.editContents;
d.destroy();
var p=app.activeDocument.selection;
for (var i = 0; i < p.length; i++){
p.name=n;
};