adobe-illustrator - Illustrator - 仅通过显式名称选择图层
问题描述
此脚本选择包含单词“shadow”的每一层,但它也会选择包含该单词的任何层。
例如,我如何明确地只选择“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
推荐阅读
- python - 如何在 django admin 中进行多选功能
- android - 防止谷歌凭据保存在android中
- ruby-on-rails - 无法在 ubuntu 20.04 上安装 bcrypt
- c++ - GCC 生成的代码比 G++ 慢 10 倍
- node.js - 将道具/参数传递给 HOC
- php - 如何删除特定的数据库值
- angular - ionic build error: 运行子进程 ng 时发生错误
- single-sign-on - Keycloak SSO 用户即使在单击注销后也不会注销
- transform - 在 Jolt 中从不同的输入数组和对象准备列表
- oracle - 如何使用另一个用户访问 Oracle 队列?