论坛帮助 |
社区圈子 |
日历事件 |
2020-07-11, 09:00 | #1 | ||
|
|||
java爱好者
等级: 六袋长老
|
var doc = app.activeDocument; var delSpotList = getDelSpotList(); for (i = 0; i < doc.spots.length; i++) { for(j = 0; j<delSpotList.length;j++){ if(doc.spots[i].name.indexOf(delSpotList[j])!=-1){ doc.spots[i].remove(); break; } } } /**要被删除的颜色*/ function getDelSpotList(){ var arr = new Array(); arr.push("PANTONE 290 C"); arr.push("PANTONE 299 C"); arr.push("PANTONE 365 C"); arr.push("PANTONE 431 C"); return arr; } ------------------------------------------------------------ 有界面 if (app.documents.length > 0) { var spotList = getSpotList(); var win = new Window("dialog", "JiaLan75"); var panelLocation = win.add("panel", undefined, "选择想要删除的专色"); var checkBoxList = new Array(); for(i=0;i<spotList.length;i++){ checkBoxList.push(panelLocation.add("checkbox", undefined,spotList[i].name)) } var btnOk = win.add("button", undefined, "Ok"); btnOk.onClick = function () { doSomething(); // call main function //win.close(); // close when done } win.center(); win.show(); function doSomething() { for(i=0;i<checkBoxList.length;i++){ if(checkBoxList[i].value){ spotList[i].remove(); } } app.redraw(); } } /**获取文档所有专色*/ function getSpotList() { var doc = app.activeDocument; var arr = new Array(); for(i = 0; i<doc.spots.length;i++){ arr.push(doc.spots[i]); } return arr; } |
||