Skip to main content
Known Participant
February 23, 2021
Answered

select spot color by name

  • February 23, 2021
  • 2 replies
  • 1357 views

Hi I have rectangles in all kinds of colors and other objects
I want to select only rectangles / shapes whose color contour line is Cutcontour. (Spot color)

This topic has been closed for replies.
Correct answer Charu Rajput

Thanks, I understand, it works, but it is not possible to select the contour without selecting the swatches window?


Yes, it is possible to select the objects that have CutContour  applied by parsing all pathItems exists in he document. Try following snippet

var doc = app.activeDocument;
var pathItems = doc.pathItems;
var colorName = 'CutContour';
app.executeMenuCommand("deselectall");
for (var j = 0; j < pathItems.length; j++) {
    if (pathItems[j].stroked && pathItems[j].strokeColor.spot && pathItems[j].strokeColor.spot.name == colorName) {
        pathItems[j].selected = true;
    }
}

 

NOTE: Not tested from my side but it should work.

2 replies

Charu Rajput
Community Expert
Community Expert
February 23, 2021

Hi,

You can use following commands to select

 

app.executeMenuCommand('Find Stroke Color menu item'); // select only objects with same stroke
app.executeMenuCommand('Find Fill Color menu item') // select only objects with same fill
app.executeMenuCommand('Find Fill & Stroke menu item') // select only objects with same stroke and same fill

 

 

Before executing these command, make sure to select the spot swatch in swatch panel.

 

 
Best regards
aviel222Author
Known Participant
February 23, 2021

there is a problem

Silly-V
Legend
February 23, 2021

You can't use 'CutContour', you need to have 

'Find Fill Color menu item'

 

c.pfaffenbichler
Community Expert
Community Expert
February 23, 2021

Could you please post screenshots with the pertinent Panels (Toolbar, Layers, Channels, Options Bar, …) visible? 

Shape Layers cannot have Spot Colors so far, so I am not quite sure how exactly your file is set up at current. 

aviel222Author
Known Participant
February 23, 2021

aviel222Author
Known Participant
February 23, 2021