0
votes

I've hit a bit of a roadblock when it comes to creating swatches based on entries in a text file. I can get the file to be read okay, but when it comes to actually creating the swatch (or editing an existing one) it fails.

Assuming the value of c1 is "0,100,100,5", this is editing the existing one:

set swatch ("CLIENT1") to c1

And this is creating a new one:

make new color with properties {model:process, space:CMYK, color value:{c1}, name:"CLIENT1"}

Any help would be hugely appreciated.

1

1 Answers

1
votes

Because the variable c1 is a string, not a list.

You need a list wich contains integer.

Here is a solution :

set c1 to "0,100,100,5"
set c1 to run script "{" & c1 & "}"

-- Edit :

Here's how to change the color of an existing swatch

tell active document
    set color value of swatch "CLIENT1" to c1 -- change one property

    -- or change properties 
    set properties of swatch "CLIENT1" to {model:process, space:CMYK, color value:c1}