Convert CSV to Swatch Library?

Hi everyone
I have a list of 300+ colors that I need to make into a swatch library for Illustrator. The data looks like this:
GREEN GRASS,127,187,0
PALE YELLOW,241,235,135
LIGHT YELLOW,238,231,93
DAFFODIL,249,231,21
MOONBEAM,249,223,22
etc.
It's RGB I think. In any case, I am just starting with Illustrator and I know NOTHING about scripting. Can anyone help me get aaaaalllll these colors into a swatch library, please? I am getting a migraine just thinking about putting them in one by one. LOL
I found something here, but that didn't work for me. I get an error on processing on line 75. http://forums.adobe.com/message/2877951
Error 24: app.doScript is not a function, Line 75 _> app.dpScript(speakThis, 1095978087); //AppleScript.
I get as far as choosing the csv file, and then I get the error. I think this outputs as CMYK, but not sure. Does anyone know of another script, or can anyone help me out?
Thanks,
Gina

Muppet's script was for InDesign -- I guess so it could save the swatches as an .ASE file. Illustrator's Javascript lacks this command ...
Here is a variant, based upon MM's, but stripped of all ID specific stuff. This one creates your new swatches in the current document; it creates a new swatch group with the CSV file name.
function main() {
     if (isOSX()) {
          var csvFile = File.openDialog('Select a CSV File', function (f) { return (f instanceof Folder) || f.name.match(/\.csv$/i);} );
     } else {
          var csvFile = File.openDialog('Select a CSV File','comma-separated-values(*.csv):*.csv;');
     if (csvFile != null) {
          fileArray = readInCSV(csvFile);
          var columns = fileArray[0].length;
          //alert('CSV file has ' + columns + ' columns…');
          var rows = fileArray.length;
          //alert('CSV file has ' + rows + ' rows…');
          if (columns == 4 && rows > 0) {
               exchangeSwatches(csvFile);
          } else {
               var mess = 'Incorrect CSV File?';
               isOSX ? saySomething(mess) : alert(mess);
     } else {
          var mess = 'Ooops!!!';
          isOSX ? saySomething(mess) : alert(mess);
main();
function exchangeSwatches(csvFile) {
//    var docRef = app.documents.add();
     var docRef = app.activeDocuments;
     var swatchgroup = docRef.swatchGroups.add();
     swatchgroup.name = csvFile.name;
     with (docRef) {    
        /*  for (var i = swatches.length-1; i >= 0; i--) {
               swatches[i].remove();
          for (var a = 0; a < fileArray.length; a++) {
               var n = fileArray[a][0]; // First Column is name              
               if (n == 'Cyan' || n == 'Magenta' || n == 'Yellow' || n == 'Black') {         
                    n = n + '-???'; // Reserved swatch name;
               r = parseFloat(fileArray[a][1]); // Second Column is Red
               g = parseFloat(fileArray[a][2]); // Third Column is Green
               b = parseFloat(fileArray[a][3]); // Forth Column is Bloo
               if (r >= 0 && r <= 255 && g >= 0 && g <= 255 && b >= 0 && b <= 255) {
                 var color = new RGBColor;
                 color.red = r;
                 color.green = g;
                 color.blue = b;
                 var swatch = swatches.add();
                 swatch.name = n;
                 swatch.color = color;
                 swatchgroup.addSwatch(swatch);
               } else {
                    var mess = 'Color values are out of range?';
                    isOSX ? saySomething(mess) : alert(mess);
function readInCSV(fileObj) {
     var fileArray = new Array();
     fileObj.open('r');
     fileObj.seek(0, 0);
     while(!fileObj.eof) {
          var thisLine = fileObj.readln();
          var csvArray = thisLine.split(',');
          fileArray.push(csvArray);
     fileObj.close();
     return fileArray;
function saySomething(stringObj) {
     var speakThis = 'I say, "' + stringObj + '"';
     alert(speakThis);
function isOSX() {
  return $.os.match(/Macintosh/i);

Similar Messages

  • Trying to add new swatch library, I get " Cant open, select AI 8 or above or EPS"

    I am trying to add the "Roland Color Systems Library.ai" into ID CS6.  I added the same file with no problem to AI CS3 but when I try adding it to ID, I get:
    "Cannot open file, please select an Adobe Illustrator 8 or above document or EPS file, or an Adobe Indesign Document"
    I also tried converting it to an EPS in AI then importing it again into ID but I get the same error, also tried saving into several legacy versions.  I see in the swatch library folder in ID, it seems to have a lot of ACB files that are the default swatchbook files.  Is there maybe a way to convert this to an ACB file and just drop it into that folder, or any other suggestions?

    That sounded like a good idea but Im not finding a way to export swatch books from AI.
    Im not sure what you mean about not operating ID that way though.  It has the ability to import swatch libraries but its not accepting the file im pointing to

  • Converting .csv to .ics

    Is there an easy way to convert a .csv excel spreadsheet to .ics for easy importation to iCal?

    The page says the "Convert CSV to SQL" action is in the standard Automator library, but I didn't find it and it doesn't seem to be on my system.
    However, since this page you referenced is on the developers site, I'd suspect the actions it lists would be available if you installed the developer tools from you system disks that came with your computer (or the OS upgrade if you've upgraded since then). You'll likely also want to log in and download any updates to the developer tools from the ADC site.
    Just guessing since I don't have the developers tools installed, though it seems the most plausible excuse for it saying it's there when it isn't.
    However, I'm quite convinced it would be so, since one of the actions listed is "Build Xcode Project". Xcode is only available once you've installed the developer tools, so it makes since the Automator actions wouldn't be available unless you had it installed. Other actions in that list appear to be the same in that way. And I do remember seeing the "Build Xcode Project" action when I used to have the developer tools installed, so I'm quite confident this is the case for the other actions, too.

  • How do I script Illustrator to get a PANTONE swatch from a swatch library

    I've been searching high and low, but cannot find the answer to this question.  Quite simply, I need a script to convert all PANTONE spot colors in an Illustrator file into their CMYK equivalents fromthe PANTONE BRIDGE book.
    In order to accomplish this, however, it would seem necessary for the script to search through the various PANTONE swatch library color books to find the one I'm looking for.  I have a String of the one I need, but I don't see how ExtendScript can search within the various swatch libraries (or even just the one library—"PANTONE+ Color Bridge (Un)Coated".  I can only seem to look at swatches that are in the main "Swatches" palette using Document.swatches.  Any ideas?

    I'm afraid that code gives me an 'MRAP' error in the ESTK.  But, I have actually found a way around the problem by utilizing your original suggestion of having a separate file with all of the Pantone swatches added to it so the script can grab that swatch, grab its getInternalColor, turn it into a CMYKColor, then assign the values retrieved from getInternalColor to the new swatch's four Color properties.
    Yes, it's a bit of a roundabout method and takes a lot of code, but it gets the job done quickly, and that's what I need.  Here's the code I have (The "workDoc" has already been assigned to the currently open document.):
    // To finish up, we delete the other two layers beyond the first and then save the file for use as digital printing file.
    // First, delete the two layers.
    workDoc.layers[2].locked = false;
    workDoc.layers[2].remove();
    workDoc.layers[1].locked = true;
    //          workDoc.layers[1].remove();
    // Before grouping and mirroring all of the artwork, it's time to convert all spot colors to process
    // using the PANTONE Bridge book as a reference.
    // First, let's open up the reference document that has all of the PANTONE Bridge book colors as swatches.
    var bridgeDoc = app.open(File("~/Documents/PantoneBridge.ai"));
    // Since attempting to colorize textFrame objects seems to crash Illustrator, we're best off just converting them all to paths anyway.
    var texts = workDoc.textFrames;
    for (var t = 0; t < texts.length; t++)
              texts[t].createOutline();
    var items = workDoc.pathItems;
    for (var i = 0; i < items.length; i++)
              var myPath = items[i];
              if (myPath.fillColor .typename == "SpotColor")
                        try {var procSwatch = workDoc.swatches.getByName(myPath.fillColor.spot.name + "P");}
                                  catch (e) {var procSwatch = addProcSwatch(myPath.fillColor.spot.name + "P", bridgeDoc.swatches);}
                        changePaths(myPath.fillColor.spot.name, procSwatch.color);
              if (myPath.fillColor.typename == "GradientColor")
                        for (var g = 0; g < myPath.fillColor.gradient.gradientStops.length; g++)
                                  var gStop = myPath.fillColor.gradient.gradientStops[g].color;
                                  if (gStop.typename == "SpotColor")
                                            try {var procSwatch = workDoc.swatches.getByName(gStop.spot.name + "P");}
                                                      catch (e) {var procSwatch = addProcSwatch(gStop.spot.name + "P", bridgeDoc.swatches);}
                                            changePaths(gStop.spot.name, procSwatch.color);
              if (myPath.strokeColor .typename == "SpotColor")
                        try {var procSwatch = workDoc.swatches.getByName(myPath.strokeColor.spot.name + "P");}
                                  catch (e) {var procSwatch = addProcSwatch(myPath.strokeColor.spot.name + "P", bridgeDoc.swatches);}
                        changePaths(myPath.strokeColor.spot.name, procSwatch.color);
              if (myPath.strokeColor.typename == "GradientColor")
                        for (var g = 0; g < myPath.strokeColor.gradient.gradientStops.length; g++)
                                  var gStop = myPath.strokeColor.gradient.gradientStops[g].color;
                                  if (gStop.typename == "SpotColor")
                                            try {var procSwatch = workDoc.swatches.getByName(gStop.spot.name + "P");}
                                                      catch (e) {var procSwatch = addProcSwatch(gStop.spot.name + "P", bridgeDoc.swatches);}
                                            changePaths(gStop.spot.name, procSwatch.color);
    var rasters = workDoc.rasterItems;
    var bitmapFound = false;
    var checkForTint = false;
    for (var i = 0; i < rasters.length; i++)
              var myRaster = rasters[i];
              if (myRaster.channels == 1 && myRaster.colorizedGrayscale) {if (myRaster.colorizedGrayscale) {bitmapFound = true;}}
              else if (myRaster.channels < 4 && myRaster.colorizedGrayscale)
                        if (/^PANTONE/.test(myRaster.colorants[0]))
                                  try {var rastSwatch = workDoc.swatches.getByName(myRaster.colorants[0] + "P");}
                                            catch (e) {var rastSwatch = addProcSwatch(myRaster.colorants[0] + "P", bridgeDoc.swatches);}
                                  changeRasters(myRaster.colorants[0], rastSwatch.color);
    if (bitmapFound) {alert("Found at least one colorized raster image in the Digital file.  Please manually change their colorants to CMYK.\nPlease see Chris McGee for more information.");}
    if (checkForTint) {alert("At least one raster image in the art has been converted to CMYK.  However, if its former spot color was tinted less than 100%, then you will need to manually change the colorant in the Digital file to match.\nPlease see Chris McGee for more information.");}
    // We should be done now with the PANTONE Bridge reference document, so close that.
    bridgeDoc.close(SaveOptions.DONOTSAVECHANGES);
    app.redraw();
    function addProcSwatch(swatchToGet, docSwatches)
              var bridgeSwatch = docSwatches.getByName(swatchToGet);
              var newSwatch = workDoc.swatches.add();
              var spotName = bridgeSwatch.color.spot.name;
              var spotValue = bridgeSwatch.color.spot.getInternalColor();
              newSwatch.color = CMYKColor;
              newSwatch.name = spotName;
              newSwatch.color.cyan = spotValue[0];
              newSwatch.color.magenta = spotValue[1];
              newSwatch.color.yellow = spotValue[2];
              newSwatch.color.black = spotValue[3];
              return newSwatch;
    function changePaths (colorName, newColor)
              var allItems = workDoc.pathItems;
              for (var j = 0; j < allItems.length; j++)
                        var thisPath = allItems[j];
                        if (thisPath.fillColor.typename == "SpotColor" && thisPath.fillColor.spot.name == colorName)
                                  var thisTint = thisPath.fillColor.tint / 100;
                                  thisPath.fillColor = newColor;
                                  thisPath.fillColor.cyan *= thisTint;
                                  thisPath.fillColor.magenta *= thisTint;
                                  thisPath.fillColor.yellow *= thisTint;
                                  thisPath.fillColor.black *= thisTint;
                        if (thisPath.fillColor.typename == "GradientColor")
                                  for (var g = 0; g < thisPath.fillColor.gradient.gradientStops.length; g++)
                                            var gStop = thisPath.fillColor.gradient.gradientStops[g];
                                            if (gStop.color.typename == "SpotColor" && gStop.color.spot.name == colorName)
                                                      var thisTint = gStop.color.tint / 100;
                                                      gStop.color = newColor;
                                                      gStop.color.cyan *= thisTint;
                                                      gStop.color.magenta *= thisTint;
                                                      gStop.color.yellow *= thisTint;
                                                      gStop.color.black *= thisTint;
                        if (thisPath.strokeColor.typename == "SpotColor" && thisPath.strokeColor.spot.name == colorName)
                                  var thisTint = thisPath.strokeColor.tint / 100;
                                  thisPath.strokeColor = newColor;
                                  thisPath.strokeColor.cyan *= thisTint;
                                  thisPath.strokeColor.magenta *= thisTint;
                                  thisPath.strokeColor.yellow *= thisTint;
                                  thisPath.strokeColor.black *= thisTint;
                        if (thisPath.strokeColor.typename == "GradientColor")
                                  for (var g = 0; g < thisPath.strokeColor.gradient.gradientStops.length; g++)
                                            var gStop = thisPath.strokeColor.gradient.gradientStops[g];
                                            if (gStop.color.typename == "SpotColor" && gStop.color.spot.name == colorName)
                                                      var thisTint = gStop.color.tint / 100;
                                                      gStop.color = newColor;
                                                      gStop.color.cyan *= thisTint;
                                                      gStop.color.magenta *= thisTint;
                                                      gStop.color.yellow *= thisTint;
                                                      gStop.color.black *= thisTint;
    function changeRasters (colorName, newColor)
              var allRasters = workDoc.rasterItems;
              for (var j = 0; j < allRasters.length; j++)
                        var thisRaster = allRasters[j];
                        if (thisRaster.channels > 1 && thisRaster.channels < 4 && thisRaster.colorizedGrayscale)
                                  if (/^PANTONE/.test(thisRaster.colorants[0]) && thisRaster.colorants[0] == colorName)
                                            thisRaster.colorize(newColor);
                                            checkForTint = true;
    // That concludes all of the color-changing steps.
    I hope this helps anyone else who is running into this (admittedly unusual) situation.

  • How to create a swatch library from multiple png files?

    Illustrator CC
    I am having a difficult time trying to create a new swatch libray of patterns from multiple png files. The way I am doing this is very slow and repetitive and seems silly for a tool as advanced as the latest CC suite including illustrator.
    What it seems I must do is open all the png files in Illustrator, creating multiple workspaces, drag one png file into the swatch window, then save that window as a library, close the existing window to reveal the next png file, open the user library I just created, drag the next image into the currently active swatch window, then drag the previous swatch/s from the user library into the current active swatch window, resave and replace the user defined swatch library (now with two images in there)fromthe updated current active swatch panel/window, close the existing workspace to reveal the next image file, and then repeat the process again, slowly building the user defined swatch library up by adding one image at a time and then adding back into the Swatch panel the previously built up library of swatches again one at at time.  (you can select all from the existing  user defined library and drag over into swatch panel, but this creates at least one  duplicate on each cycle for as soon as you click on the first swatch in the library, it adds itto the current swatch panel and then when you select all swatches to drag across it includes the first swatch and copies it again)
    This is a very slow process to build up a swatch library. For some reason you cannot drag swatches directly into  the user defined library you have created, only into the active swatch window for each workspace. I searched the web and forums  for answers but could find none. There must be an easier way,  just can't find it.
    Ideally, the best option would be a swatch window  option that allows the import directly from a list of selected files in the finder.
    Any ideas out there?

    Monika,
    Thank you for responding, however I am not exactly clear on what you mean by "libraries are plain AI files". For example, I cannot find a file with the same name as my user defined library name that I have created. I can find the preinstalled swatches listed under Adobe Application Support... Library... Swatches, but a user defined folder is not present and the library sets that I have already created are not visible. I have tried searcing my Mac for a (name).ase file and still no luck (at least for the name I was looking for). I can open the user defined library from the Swatch library icon on the bottom left of the Swatch panel, but when I open this I cannot drag and drop add new swatches directly to this library. As stated above, I have to add each pattern, one at at time to the normal swatch panel, then add back the previous ones I have saved from the user defined library to the swatch panel and then save threm all as an updated user defined library. Thus by repeating this process, it builds up the user defined library one at a time.
    I am using Illustrator CC if this makes a difference.

  • How do I select a set of swatches (ideally at once) from a long list to create a swatch library?

    I just started using PS (CS6) and I added 10 new custom swatches that I want to save in a new swatch library. However, I still have the PS default library of swatches listed (that contains scores of colors). Can I select multiple swatches at once to save them for the swatch library? Or do I need to delete ALL the default swatches first manually, then save the remaining colors in the new swatch library? If so, it makes it a daunting task...

    I watched a tutorial on the Preset Manager and was able to finally select multiple swatches to create a swatch library by using the [Shift] key while selecting.
    One of the problems was that the swatches were displaying as small thumbnails and it was difficult for me to see each swatch selected (plus, the outline of the selections were blue, and many of the colors I selected were blue).
    What also through me off was that when you display swatches in a pane (say, when working on an image), one of the dropdown options is "Save Swatches", which I thought allowed you to save swatches in a library (not just an individual swatch).
    Without the tutorial, I don't think I would have been able to figure out the right steps! Thanks for the tips, guys.

  • Custom swatch library isn't updating in CC

    I have a big custom swatch library that I'm continually making additions and corrections to. I have it set as persistent, and the library works fine, but it doesn't update when I make changes to it. As far as I can tell, it's still stuck at the point where I upgraded to CC a few months ago. I've tried unchecking persistent, closing the library and Illustrator, then reopening and reinstalling the library, and it's still reverting to the old version.
    Anyone else having this problem?
    I've just upgraded to 17.1 on a Windows 7 Pro machine.

    Hi OuraySportswear,
    Do you have this library file outside of presets folder? Currently this feature sync these libraries from presets folder only.
    Sanjay.

  • Auto update colors (from custom swatch library) in documents..

    Hi all,
    I searched the forums for all I could, but found no solution for this one...
    So here goes.
    Is there a way to use a 'user defined' swatch library to (auto)update colors in several artworks/files that use that specific swatch library.
    I know I could reload and 'merge' all the swatches from the library with the ones used in the file (with the same name).
    Select the one you want to keep and then the one you'd like to overwrite, merge!
    But here's what I tried and what I think should be possible..
    I have twelve files that all use colours from one 'user defined' swatch library ['Human'], so all twelve files have the same 'skin' colour where needed.
    Now I need the 'skin' colour (in alle twelve files) to be a shade darker...
    My idea was to open the swatch library 'Human' in Illustrator, change the swatch called 'skin' and save.... Presto! All twelve files using this 'skin'colour should now be one shade darker...
    But this doesn't seem to work...
    Swatches are set to 'global'..
    What am I missing or will this be in the 'features requests' part of these forums next?
    Oh and I'm working in:
    Illustrator CS5, windows 7, 64 bit
    Kind regards,
    Erik

    As far as I know color swatches are referenced from the file itself, they are not like a linked image that can update all files using it. So, with swatches you have to apply the change to each file. Probably should be possible to automate this with a script.

  • Edit custom swatch library

    Hi All,
    This may be a stupid question:
    Once I have created and saved a custom swatch library - lets call it "custom"
    How would I add a new colour to "custom" - or edit a colour value in "custom" - is this new swatch library locked?
    Most frustrating.
    Thank you

    open the library file, just through File > Open. add a swatch to the document. save the document swatches as swatch library

  • Swatch library in AI 10 missing

    I have just opened up a file and discovered that the pantone swatch library has disappeared!
    Under window there is a tab for swatches, but there isn't an option to import them. Looking in the application folder I can see under presets that there is folder called swatches and within a whole array of pantone libraries.
    I need to get them into illustrator. Anyone know how to do this?

    I do not think that the term Color Book was used back then so unless you have such an item listed then I would say you have a corrupt font data base or corrupt font in your user account.
    It is a known issue that if that where true it would prevent the swatch libraries from loading since the fonts load first.

  • Swatch library..

    Hi,
    I'm new to Illustrator Scripting..
    Swatch library contains some set of preset colors like pantone, hsk etc.. I need to find out the counting of tat..
    I don't know tat how to find out tat...
    Can anyone help me...

    I do not think that the term Color Book was used back then so unless you have such an item listed then I would say you have a corrupt font data base or corrupt font in your user account.
    It is a known issue that if that where true it would prevent the swatch libraries from loading since the fonts load first.

  • Change Default Swatch Library

    I created a swatch library in InDesign that I'm going to send to multiple computers and access there. Is there a way to make my swatch library the default library that comes up when I open a new document? I tried loading it and then saving my workspace, but when I open a new document, the default swatch palette is there. I haven't found any options yet. Could someone help? Thanks!
    I'm using InDesign CS2 on a PC.

    Load the swatches with nothing open, then close InDesign. Swatches are saved as part of the preferences, not as part of a workspace.
    For the location of preference files in Windows, see the comments on this page: http://livedocs.adobe.com/en_US/InDesign/5.0/help.html?content=WSa285fff53dea4f8617383751 001ea8cb3f-6d1e.html
    Another option would be to export the swatches as an Adobe Swatch Exchange (ASE) file, although this option does not support all swatch types. The advantage of the ASE file is it can be loaded into Illustrator of Photoshop as well.
    Peter

  • My Pantone Color Swatch Library is Missing from Illustrator

    I've searched the computer for this PMS color swatch library... can't find it. How do I get it back? I NEED IT asap! Ahhh! Please help?

    This isn't really about color management. To reach the largest group
    of people who might be able to help, try the Illustrator forum
    (Windows or Mac). Be sure to say what version, and if you can remember
    what changed between this last working and now that might help too.
    Aandi Inston

  • Creating a CMYK/RGB/HEX/PMS Swatch Library

    I'm trying to create a Swatch Library with all of the above mentioned colour spaces.
    But when I'm trying to create a CMYK swatch in an RGB document colour mode, after I create the swatch (95/95/25/10) and add it to the swatch library when I click on the swatch it opens the swatch in the RGB mode or when I switch it over to CMYK, the colour has shifted (to say 94.67/93.3/24.9/9.75).
    I would ideally like to have all of these colour spaces in one library, instead of having to create 2 different libraries: One a 'print' version and the other a 'digital'?

    A swatch library will be either CMYK or RGB depending on the document color mode you create it in.

  • How to convert csv files into java bean objects?

    Hi,
    I have a CSV file, I want to store the data availabale in that csv file into java bean, I am new to this csv files how can I convert CSV files into java beans.
    Please help me.
    Adavanced Thanks,
    Mahendra

    You can use the java.io API to read (and write) files. Use BufferedReader to read the CSV file line by line. Use String#split() to split each line into an array of parts which were separated by comma (or semicolon). If necessary run some escaping of quotes. Finally collect all parts in a two-dimensional List of Strings or a List of Javabeans.
    java.io API: [http://www.google.com/search?q=java.io+javase+api+site:sun.com]
    java.io tutorial: [http://www.google.com/search?q=java.io+tutorial+site:sun.com]
    Basic CSV parser/formatter example: [http://balusc.blogspot.com/2006/06/parse-csv-upload.html]

Maybe you are looking for

  • No longer able to save to a .PDF using Acrobat 8 Pro and any CS3 program

    I spent several hours on phone with Apple and Adobe today-It seems that Snow Leopard and Anything below Acrobat Pro 9 and InD 4 are no longer compatible for exporting, printing or saving as a .PDF.  Using Acr. Pro 8 and InD CS 3  Anyone find a fix as

  • N:1 Multi mapping Not working !!

    Hi Guys, I have input xml message structure as follows: <ROOT>     <OUTPUT>    ----------------------0..n         <XQ_Segment>  ---------------- 0..1                 XQ_DATA  -----------------0..1                 XQ_Value  -----------------0..1      

  • Max connections in Oracle 10g Express

    Hi, How much connections are possible in Oracle 10g Express ?

  • 1 java file can trigger one of 2 servlets?

    I have a form and a servlet that processes it. but now i have to have the form do something else if the user picks a certain radio button. I thought of having an If statement that would check if the radio button was checked. If it was, I need another

  • EOF on socket error

    Hi, I am trying to read from a mail box using a simple program. when i try to connect to the mailbox, it gives me this exception. The program was working until two weeks back and suddenly started giving this error. please help. Thanks in advance. VR