select stroke color

Explorer ,
Jan 28, 2021

Copy link to clipboard

Copied

I have simple rectangle with stroke of magenta color. i need script that select only the rectangle by storke color (magenta) 

TOPICS
Scripting

Views

61

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Jan 28, 2021

Copy link to clipboard

Copied

Hi,

try following snippet to select all rectangles with magenta stroke.

#target illustrator
function main() {
    app.selection = null;
    var doc = app.activeDocument;
    var _path;
    for (var i = 0; i < doc.pathItems.length; i++) {
        _path = doc.pathItems[i];
        if (_path.stroked && _path.strokeColor.magenta > 25) {
            _path.selected = true;
        }
    }
}
main();

  

Best regards

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more