- 精华
- 活跃值
-
- 积分
- 337
- 违规
-
- 印币
-
- 鲜花值
-
- 在线时间
- 小时
累计签到:14 天 连续签到:1 天
|
无界面
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;
}
|
|