Creating a color in InDesign Javascript (CC)
Hello everyone:
I am using this code to try to create a color that can be used to fill a button:
function MakeButtonColor()
{
var TheColor;
var TheDocument = app.activeDocument;
var myError;
try
{
TheColor = TheDocument.colors.item("DPSButtonColor");
var ColorName = TheColor.name;
}
catch(myError)
{
TheColor = TheDocument.colors.add({name: "DPSButtonColor", colorSpace:ColorSpace.RGB, model:ColorModel.process,colorValue:[0,137,208]});
}
var ButtonColor1 = TheColor;
alert("ButtonColor is " + ButtonColor1.name);
}
I am taking this directly from the Scripting Guide with only a very few modifications.
But I never ever see the last two statements executed. I've tried all sorts of things to make this work and it just doesn't want to work.
Anyone have any ideas why it won't work and what I can do to fix it?
