以所有选定的 Illustrator 对象为目标,或者如果选择了 none,则以所有对象为目标
Target all selected Illustrator objects, or target all objects if none are selected
我如何定位 Adobe Illustrator 脚本以在选择任何内容时将其自身限制为用户的选择,或者在未选择任何内容时对所有对象运行 进行限制?
app.activeDocument.selection
通常用于定位当前选择,但如果没有选择则为空。
app.activeDocument.pageItems
是访问所有项目的地方,就像选择了所有内容一样。所以,这个班轮:
var scope = app.activeDocument.selection.length ? app.activeDocument.selection : app.activeDocument.pageItems;
...将变量 scope
设置为选择(如果有的话),如果有 none 则设置为所有内容。然后其内容可以通过正常方式循环,例如:
for(var i=0;i<scope.length;i++){
// do things with scope[i]
}
我如何定位 Adobe Illustrator 脚本以在选择任何内容时将其自身限制为用户的选择,或者在未选择任何内容时对所有对象运行 进行限制?
app.activeDocument.selection
通常用于定位当前选择,但如果没有选择则为空。
app.activeDocument.pageItems
是访问所有项目的地方,就像选择了所有内容一样。所以,这个班轮:
var scope = app.activeDocument.selection.length ? app.activeDocument.selection : app.activeDocument.pageItems;
...将变量 scope
设置为选择(如果有的话),如果有 none 则设置为所有内容。然后其内容可以通过正常方式循环,例如:
for(var i=0;i<scope.length;i++){
// do things with scope[i]
}