6 Replies Latest reply on Jan 20, 2016 4:15 PM by davidn5918184

    [JS][CS3] Create new swatch

      Hi all,

      I'm writing a script that reads an xml file and then converts the contents to InDesign Objects.
      Most of this I can do, but I'm having problems with the colors and swatches in InDesign.

      Simple said, what I'm trying to do is the following:
      1. Create a rectangle on my document
      2. Create a new Color Swatch with CMYK values
      3. Use the swatch for the rectangle's fillColor or strokeColor

      Using Javascript I can add new colors tot my document: myDoc.colors.add()
      But I can't use this color for the fillColor or strokeColor properties, it says they it needs to be a swatch, and not a color.

      Unfortunately, the method myDoc.swatches.add() doesn't exist, and I can't set a colorValue property to a swatch.

      Does anybody know how to do this? I'm guessing there's a simple solution for this, but I'm just not seeing it.

      Thanks in advance,
      Dany