How to script Illustrator to get a library of shades PANTONE color chart

I've searched high and low, but can't find the answer to this question.  Quite simply, I need a script to convert all spot colors PANTONE an Illustrator file in the PANTONE BRIDGE book CMYK equivalents.

To do this, however, it seems necessary for the script to search through the various books PANTONE swatch library color to find the one I'm looking for.  I have a string that I need, but I don't see how ExtendScript can perform a search in the libraries of different shades (or even just the a library - 'Coated + PANTONE Color Bridge (UN)'.  I can't just to watch the nuances 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 actually found a way around the problem by using your original suggestion to have a separate file with all color swatches Pantone, added to this, then the script can enter this shade, grasp its getInternalColor, turn it into a CMYKColor, then assign the extracted values of getInternalColor of four properties of the colors of the new shade.

Yes, it is a bit of a roundabout method and takes a lot of code, but it does the job quickly, and that's what I need.  Here is 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 someone else who is faced with this (admittedly unusual) situation.

Tags: Illustrator

Similar Questions

  • How is the Pantone color chart more Series is not everything appears under the pantone + solid coated library? Some colors are missing...?

    In illustrator CC under the menu LIBRARY of NUANCES, under COLOR BOOKS, in PANTONE + COATING SOLID, I can not find the green color C 2290 or any green color of the series?

    These colors are available? What's wrong?

    Standard text:

    Update of the Adobe color books:

    http://Pantone.custhelp.com/app/answers/detail/A_ID/1803/~/exporting-PANTONE-libraries-for-Adobe-and-other-solutions-from-PANTONE-color

    PANTONE Color Manager does not 'automatically' Refresh libraries; on the contrary, it gives you access to libraries for export in your applications.

    The steps to do this are entirely documented within the system of online help installed with the software and accessible from the Help menu. You can find them on Page 11 y. Here's a brief description:

    1. If your target applications are open, close them.
    2. launch PANTONE Color Manager
    3. go on display/Fandeck, then select the library you want to export.*
    4. go to file/export/select your application/choose L * a * b * to print or sRGB for Web design *.
    5. the library is exported and is now accessible from your target application.

    * PANTONE Color Manager also allows you the flexibility to assemble and work with color palettes, or apply an output profile for your front of libraries/pallets for export, to provide management of the PANTONE colors for a particular device. Please refer to the 'Help' system for more details.

    * PANTONE + Color Bridge libraries must be exported in CMYK.

    -OB

  • How can I change my design to a pantone color together?

    Can someone please help as how to change my document to be pantone 280C?

    If the identity of the brand should always be Pantone 280 logo should exist as such. Ideally, a logo should be designed in the expected color, in levels of gray and black & white. Are these are available in the original native format? Always lean towards the use of a vector image format if available.

    It is important to know how it is to be printed. My answer "1 - export a PDF ready press and your printer to print all in Pantone 280.» They print everything in shades of gray and run Pantone 280 " only works in traditional offset. If it is digital printing answer 2 applies.

    For a jpg file, open the image in Photoshop (or equivalent) and convert it to grayscale (giving it a unique name; save your original).

    In InDesign select the image with the direct Selection tool and apply the Pantone color chart.

  • How to print the pantone colors

    I have a CS3 with a 10.5.8, operating system and I want to print a file that I did with the Pantone color chart.

    My printer is a Canon Pixma iP 4000.

    I tried to use photoshop manages colors in handling, with cmyk-US web coated printer profile, with relative colorimetric intent color rendering.

    Black point compensation?

    Please tell us what settings should I use to get the colors pantone correctly under color management

    Thank you

    Finnegan56

    Oh dear... you can't!

    You will need xxxx PANTONE ink... ie: its for offset printing, printing etc. of screen not for desktop printers

    G

  • How to write a script for date get to the Clipboard

    Hi experts,

    How to write a script for date get to the Clipboard.

    the date format will be like this:

    05 - may

    respect of

    John

    Thanks guys, thanks Sanon

    I finally use the .bat doc

    like this:

    @@echo off
    for /f "delims =" % in (' wmic OS Get localdatetime ^ | find ".") "") Set "dt = %% a"
    the value "YYYY = % dt: ~ 0, 4%.
    the value "MM = % dt: ~ 4, 2%.

    If MM % is 01 set MM = January
    If % MM == 02 set MM = February
    If MM % is MM value = March 03
    If MM % is 04 MM value = April
    If MM % is 05 MM value = may
    If MM % is 06 MM value = June
    If MM % == 07 set MM = July
    If MM % is MM value = August 08
    If MM % is MM value = September 09
    If MM % is 10 MM value = October
    If MM % is 11A set MM = November
    If MM % is game MM 12 = December

    the value "DD = % dt: ~ 6, 2%.
    the value "HH = % dt: ~ 8, 2%.
    the value "Min = % dt: ~ 10, 2%.
    Set "s = % dt: ~ 12, 2%.

    Echo DD - MM HH % %% % Min | Clip

    It works

    respect of

    John

  • How to get the graph to print in color when added by script

    Hi all

    I'm trying to add an image to an article through dal, but it does not print in color when it is added using script. But if manually added it prints in color.

    Do I need to have any setting for this. Please let me know.

    Thank you.

    I'm not 100% sure that this will work, but you can try adding an empty bitmap in Studio to your section, make sure that it is marked as color printing. And then use script DAL CHANGELOGO function to change the bitmap that you want to print. So, indeed, you replace ADDLOGO by CHANGELOGO in DAL and create a bitmap on in the Studio.

  • How to remove the user defined color chart in illustrator cc

    How can I remove groups swatch defined by the user in the menu in illustrator CC drop down 'open the Swatch Library? I'm on a Mac Book Pro 13.

    Hi Peter,.

    You can navigate to: Applications > Adobe Illustrator CC 2015 > Presets > en_US > color chart, and there, you can manually delete the user defined color chart.

    Thank you

    OM

  • CS4 Design Premium I migrated to my new laptop, but when I try to enter in InDesign or Illustrator, I get message "license for this product has stopped working... error code 150:30.

    CS4 Design Premium I migrated to my new laptop, but when I try to enter in InDesign or Illustrator, I get the message "a license for this product has stopped working... error code 150:30" how to re-enable programs CS4? Thank you.

    Could you please check the solutions:

    1. License for this product has stopped working error 150:30
    2. Error: "License has stopped working". Mac OS
    3. Error: "License has stopped working". Windows

    Concerning

    Stéphane

  • HELP, trying to install Illustrator but get this message that I need to download "Adobe Support Advisor" when I go on the site, I see that it has been abandoned, what should I do now? got trapped in the maze of ther HELP HELP!

    HELP, trying to install Illustrator but get this message that I need to download "Adobe Support Advisor" when I go on the site, I see that it has been abandoned, what should I do now? got trapped in the labyrinth HELP HELP!

    Hi Joseeyk67276640,

    'Download Support Advisor' is a generic error, and we need to understand what is causing the problem. Most of the time, its a problem with the download was not successful or downloaded correctly. So, in this case, re-download the software and do not forget to compare the file size of the file downloaded with the file on the server.  From the following link, please download the version of Illustrator, you need: other downloads

    Allows you to check in this case as well and make sure that the download is complete, if the size of the file is correct, to the install.log file.

    Navigate in the log files in one of the following folder:

    Mac OS: / Library/Logs/Adobe/Installers /.

    C:\Program Files (x 86) \Common Files\Adobe\Installers\

    The name of the log file includes the name of the product and installation date, followed of ".". log.gz."the .gz extension indicates a compressed format.

    You can use a utility to extract the 7z or gz to unzip.

    Once unzipped, the log file is a text file, open the .log using TextEdit (Mac OS) and notebook (OS Win)

    Scroll to the bottom of the log. Look in the section - summary - for lines that begin with ERROR or FATAL and signals a failure during the installation process.

    Copy and paste this section SUMMARIZED here so that we can check for errors. Alternatively, you can analyze the logs yourself. http://helpx.Adobe.com/Creative-Suite/KB/troubleshoot-install-logs-CS5-CS5.html

    Let us know if that helps.

  • Lack of Pantone color in Illustrator Library

    Hello world

    I work with Illustrator 6 and here my question:

    The Pantone Coated 2167 C and 626 C are not available. How to manage to add all the missing colors in the library?

    Thanks in advance for your help.

    Fanny

    There is nothing wrong in sharing libraries. Two sources:

    This thread of the InDesign forum - see #129 on the last page:

    https://forums.Adobe.com/message/8289623?TSTART=0#8289623

    Then see what it does refer to:

    Sharing libraries of PANTONE Color Manager with task force - Pantone.com

  • How to activate "Folio showcase in the library?

    http://helpx.Adobe.com/Digital-Publishing-Suite/help/whats-new-release.html


    "If your iPad app offers subscriptions, you will probably want to promote your latest content and buying options are displayed correctly. To help with this, new v31, subscription iPad apps have new default library with a new appearance to help promote your content. The most recent folio will have an important presentation to help encourage readers to identify the most recent content available for purchase or subscription. If a free preview of content is offered, which is called out too. »


    When I build an app I always get the old library.


    We have subscription.


    How to activate "Folio showcase in the library?


    Male version of the viewer in App Builder is set to r31. Also, note that if you have a custom store implemented and the option 'Hide buy buttons' checked that the default library to the old grid view.

  • How to export Illustrator images for iOS 7 iPad and iPhone

    How to make an asset I have created in Illustrator and save them in resolutions appropriate for iOS (retina, non-retine, iPhones and iPads, etc.)?

    I looked at these pages, but they did not help me understand what to do in Illustrator to get the result intended:

    http://beageek.biz/how-to-create-launch-images-app-Xcode-iOS/

    http://www.idev101.com/code/User_Interface/launchImages.html

    http://www.Axialis.com/tutorials/make-iPad-icons.html

    Please don't give answers about Flash, Adobe AIR or Photoshop. These applications, including Adobe AIR are not what I need assistance.

    The question is about Adobe Illustrator.

    I'm building an application in xcode on a MacBook Pro and using Adobe Illustrator CC.

    Thank you

    W

    Should be OK to create your image in the respective pixel dimensions, and then export to 72 dpi.

  • I unsubscribed from my application only one then it refunded, but how long does take to get to my accounan for me to get my money back

    I bought a computer application don't work well one I unsubscribed from my application one then it refunded, but how long does take to get to my accounan for me to get my money, I have looking for Bowen but I Don t have the refund back on my account

    < re-titled by host >

    Normally apple support sends you an email when a purchase is refunded. Most of the time it will hit your account within 72 hours.

  • How to set up a second music library on drive ext

    How can I set up a second library music on external drive?

    2006MacBook OS 10.6

    Launch iTunes with down option, click on create a library and choose a location on it.

    (144334)

  • How can I do to get the Apple CERT?

    How can I do to get the Apple CERT?

    http://training.Apple.com

Maybe you are looking for