【发布时间】:2023-01-30 16:47:48
【问题描述】:
我有一个基本的 JavaScript,它应该将所选项目从 CMYK 黑色更改为名为 Bronze 的色板颜色,但它不起作用。关于代码应该看起来有什么建议吗?
// Get the active document
var doc = app.activeDocument;
// Check if there is a selection
if (doc.selection.length > 0) {
// Get the first selected object
var obj = doc.selection[0];
// Check if the object has a fill
if (obj.fillColor > 0) {
// Set the object's fill color to the "Bronze" swatch
obj.fillColor = 5;
}
}
【问题讨论】:
-
请替换 5,使该行显示为 obj.fillColor = "Bronze";
标签: javascript-objects extendscript