myfile.ai中有一些复合路径项目
如何从jsx运行“对象>复合路径>制作”或发送“ctrl + 8”?与注释错误在这里我收到错误消息“无法在指定位置创建新对象”。
#target illustrator
if (app.documents.length > 0) {
var idoc = app.activeDocument;
var cp = idoc.compoundPathItems.add();
var allPaths = activeDocument.pathItems;
//Select objects
for(var i = 0;i < allPaths.length;i++){
allPaths[i].selected = true;
}
var selection = app.activeDocument.selection;
for (var i=0; i<selection.length; i++) {
selection[i].move (cp, ElementPlacement.PLACEATEND); // move selected path inside the compound path ERROR HERE
selection[i].evenodd = true; // necessary to determine "insideness" or to make holes.
}
alert(selection);
答案 0 :(得分:0)
app.executeMenuCommand("compoundPath");