0
Explorador
,
/t5/illustrator-discussions/can-someone-share-script-that-renames-objects-in-an-layer/td-p/12881295
Apr 14, 2022
Apr 14, 2022
Copiar link para a área de transferência
Copiado
I do have objects with different names but common words in the name. I want to be able to use a script to "Find and Replace" words in an randomly named layer. Objects can be 500+ sometimes.
Endgoal Example:
Select all objects in the layer run the script get an pop up like "Find and replace" in Excel, type the old name/s then type the new name/s and the words to be replaced in every selected object.
TÓPICOS
Scripts
Diretrizes da comunidade
Seja respeitoso, dê crédito à fonte original do conteúdo e verifique se há cópias antes da publicação.
Saiba mais
1 resposta correta
Guia
,
Apr 15, 2022
Apr 15, 2022
// select items
var doc = app.activeDocument;
var input1 = prompt('Enter strings separated by comma and space (", ")', "find this, replace with this");
var input2 = input1.split(", ");
var find = new RegExp(input2[0], "g", "i");
var replace = input2[1];
for (var i = 0; i < app.selection.length; i++) {
app.selection[i].name = app.selection[i].name.replace(find, replace);
}
Explorar tutoriais e artigos relacionados
Guia
,
/t5/illustrator-discussions/can-someone-share-script-that-renames-objects-in-an-layer/m-p/12881486#M318450
Apr 15, 2022
Apr 15, 2022
Copiar link para a área de transferência
Copiado
// select items
var doc = app.activeDocument;
var input1 = prompt('Enter strings separated by comma and space (", ")', "find this, replace with this");
var input2 = input1.split(", ");
var find = new RegExp(input2[0], "g", "i");
var replace = input2[1];
for (var i = 0; i < app.selection.length; i++) {
app.selection[i].name = app.selection[i].name.replace(find, replace);
}
Diretrizes da comunidade
Seja respeitoso, dê crédito à fonte original do conteúdo e verifique se há cópias antes da publicação.
Saiba mais
D.S..
AUTOR
Explorador
,
MAIS RECENTE
/t5/illustrator-discussions/can-someone-share-script-that-renames-objects-in-an-layer/m-p/12881553#M318455
Apr 15, 2022
Apr 15, 2022
Copiar link para a área de transferência
Copiado
It does the job perfectly!
Thank you so much! 🙂
Diretrizes da comunidade
Seja respeitoso, dê crédito à fonte original do conteúdo e verifique se há cópias antes da publicação.
Saiba mais

