Illustrator - Select 仅按明确名称命名的图层
Illustrator - Select layer by explicit name only
此脚本 select 包含每个包含单词“阴影”的图层,但它也会选择任何包含该单词的图层。
我如何明确地仅 select 例如“shadow”和“shadow-7”,以便它忽略“shadow-4”、“shadow-5”等?
var aDoc = app.activeDocument;
var pI = aDoc.pageItems;
aDoc.selection = null;
for (i=pI.length-1; i>=0; i--) {
if (pI[i].name.match(/shadow/i) != null) {
pI[i].selected = true;
}
}
您需要将正则表达式 /shadow/i
更改为 /^shadow$/i
此脚本 select 包含每个包含单词“阴影”的图层,但它也会选择任何包含该单词的图层。
我如何明确地仅 select 例如“shadow”和“shadow-7”,以便它忽略“shadow-4”、“shadow-5”等?
var aDoc = app.activeDocument;
var pI = aDoc.pageItems;
aDoc.selection = null;
for (i=pI.length-1; i>=0; i--) {
if (pI[i].name.match(/shadow/i) != null) {
pI[i].selected = true;
}
}
您需要将正则表达式 /shadow/i
更改为 /^shadow$/i