Copy link to clipboard
Copied
Does anyone have a script that would locate an object by Spot Color name and delete it? Specifically, we have a customer that places a "Live" area box that I always have to delete. I would like to simply run an action that would delete it automatically so I don't have to search all the layers to find it.
Copy link to clipboard
Copied
On mobile, but something like this?
var doc = app.activeDocument;
var apis = doc.allPageItems;
var i = apis.length;
while(i--) {
if (apis[i].filled && apis[i].fillColor.name == "SwatchName") { apis[i].remove(); }
}
Hopefully you can get your client to appreciate the value of putting nonprinting items on their own layer(s).
Copy link to clipboard
Copied
Yes....something like that. Only a stroke not a fill.
With some conversation with the client, we are hoping to get them to understand proper file creation.
Copy link to clipboard
Copied
Hi @Joseph34576598wd3q , I’m getting an error with @brian_p_dts ’s code—I think apis[i].filled is a typo. This includes a dropdown dialog of document swatches with Brian’s code edited, and gets the page item‘s stroke color
var cs;
var d = app.dialogs.add({name:"Stroke Color", canCancel:true});
with(d){
with(dialogColumns.add()){
cs = dropdowns.add({stringList:app.activeDocument.swatches.everyItem().name, selectedIndex:0, minWidth:80});
}
if(d.show()){
cs = app.activeDocument.swatches.everyItem().getElements()[cs.selectedIndex];
var apis = app.activeDocument.allPageItems;
var i = apis.length;
while(i--) {
if (apis[i].strokeColor.name == cs.name) { apis[i].remove(); }
}
d.destroy();
}
}