I want to apply "Red", "Yellow", "Green" one at a time as a stroke color to the rectangle
On looking into the pageitem property I have found that I can do the above thing as follows
selectedPageItem.strokeColor = MyColor
But the above proprty needs a swatch type variable.
To handle this I tried following.
// I added a red color on swatch panel
activeDoc.colors.add("R=100 G=0 B=0");
then tried to set stroke color as follows
selectedObjects.strokeColor = activeDoc.swatches.item("R=100 G=0 B=0");
But above statement throws an exception.
If anybody have done this then please let me help to achieve this
app.activeDocument.swatches // 0 as an index
app.activeDocument.swatches.item(0) // 0 as an index
app.activeDocument.swatches.itemByName("foo") //foo as a string representing the swatch name
Thanks for your reply
I am able to got the solution
It can be achhieve as follows
var myColor = activeDoc.colors.add();
myColor.model = ColorModel.PROCESS;
myColor.space = ColorSpace.RGB;
myColor.colorValue = [255,0,0];
myColor.name = "myTestColor";
selectedObjects.strokeColor = myColor;