Skip navigation
¶eter
Currently Being Moderated

How to call a swatch from the library

Jul 20, 2012 8:31 AM

Tags: #library #pantone #extendscript #swatches

Hi,

 

I'm writing a script to create a new AI document with a restricted swatchbook. The designer is supposed to use only the swatches/inks provided by this script.

So far I was able to delete all current swatches and add a CMYK or RGB spotcolor swatch.

 

var inkt02 = app.activeDocument.spots.add();

inkt02.name = 'inkt 2';

inkt02.colorType = ColorModel.SPOT;

var kleur02 = new CMYKColor();

kleur02.black = 10;

kleur02.cyan = 80;

kleur02.magenta = 0;

kleur02.yellow = 90;

inkt02.color = kleur02;

var newSpotColor = new SpotColor();

newSpotColor = inkt02;

newSpotColor.tint = 100;

thePallet.addSpot(newSpotColor);

 

Often we will be dealing with Pantone colors. No need to define these, as they are inside AI already, right? But how to call them from the library?

 

I'm new to ExtendScript, but this forum (and google) helped me along nicely so far :-)  I don't have a concrete use case for this yet, but I decided on this exercise as a good way to learn about ExtendScript.

 
Replies
  • Currently Being Moderated
    Jul 20, 2012 9:58 AM   in reply to ¶eter

    there's no access to library swatches, other than the main swatches palette. You would need to add those pantones to a document, then open or place that document to have access to them.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 20, 2012 10:38 AM   in reply to ¶eter

    You picked a good topic to start your learning… Total road block, such are the frustrations of scripting…   Best to get all of these out the way in the early days… and move on…

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 20, 2012 11:03 AM   in reply to Muppet Mark

    correct, it'll be a bumpy road...get the chill pills ready ....but anyhow you'll enjoy it for the most part, Mark will cheer you up.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 20, 2012 12:59 PM   in reply to CarlosCanto

    A bad workman can blame his tools… but here your forgiven… Why on earth would you want to re-colo(u)r art…? Never heard of it, now stop being silly…

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points