论坛帮助 |
社区圈子 |
日历事件 |
2024-05-17, 09:06 | #1 | |||
|
||||
正式会员
等级: 三袋长老
|
var doc = app.activeDocument; var docSpots = activeDocument.spots; var isExist = false; for (var j = 0; j < docSpots.length; j += 1) { if (docSpots[j].name.toString() == "UV") { spot1 = docSpots[j]; isExist = true; break; } } if (!isExist) { newCMYKColor = new CMYKColor(); newCMYKColor.cyan = 100; newCMYKColor.magenta = 0; newCMYKColor.yellow = 0; newCMYKColor.black = 0; var newSpot = app.activeDocument.spots.add(); newSpot.name = "UV"; newSpot.color = newCMYKColor; newSpot.colorType = ColorModel.SPOT; var newSpotColor = new SpotColor(); newSpotColor.spot = newSpot; } else { var newSpotColor = new SpotColor(); newSpotColor.spot = spot1; } var isExist = false; for (var i = 0; i < doc.layers.length; i += 1) { if (doc.layers[i].name == "UV") { targetlayer = doc.layers[i]; isExist = true; break; } } if (!isExist) { targetlayer = doc.layers.add(); targetlayer.name = "UV"; } g = targetlayer.groupItems.add(); var frontPath = app.activeDocument.selection; for (var i = 0; i < frontPath.length; i += 1) { apply_G_DC(frontPath[i]); frontPath[i].duplicate(g, ElementPlacement.INSIDE); } function apply_G_DC(the_Obj) { if (the_Obj.constructor.name == "GroupItem" && the_Obj.clipped == false) { try { var N_sub_obj = the_Obj.pageItems.length; for (var i = 0; i < N_sub_obj; i += 1) { apply_G_DC(the_Obj.pageItems[i]); } } catch (error) { return; } } else { if (the_Obj.constructor.name == "CompoundPathItem") { try { var N_sub_obj1 = the_Obj.pathItems.length; for (var i = 0; i < N_sub_obj1; i += 1) { apply_G_DC(the_Obj.pathItems[i]); } } catch (error) { return; } } } apply_S_DC(the_Obj); return; } function apply_S_DC(the_Obj) { if (the_Obj.stroked) { the_Obj.strokeColor = newSpotColor; the_Obj.strokeOverprint =false ; } if (the_Obj.filled) { the_Obj.fillColor = newSpotColor; the_Obj.fillOverprint = true; } } } |
|||
回复时引用此帖 |