pathItem color name
How can I get pathItem fillcolor name (name of swatch color).?
How can I get pathItem fillcolor name (name of swatch color).?
You have to select stuff, but here's how I am able to make it work- try it:
(You must have a document with one path in it.)
#target illustrator
function test(){
var doc = app.activeDocument;
doc.selection = null;
var pathArtItem = doc.pathItems[0];
pathArtItem.selected = true;
var selectedSwatches = doc.swatches.getSelected();
if (selectedSwatches.length) {
var first_andShouldBeOnly_SelectedSwatch = selectedSwatches[0];
alert("The name of the selected swatch for this path is '" + first_andShouldBeOnly_SelectedSwatch.name + "'");
} else {
alert("No swatches were found to be selected when the art ite was selected.");
}
};
test();
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.