Script to change colors of Illustrator shapes based on excel data?

Hi. My Problem: I have a list of names in excel and I would like each name to correspond to a given color. And I have the same number of shapes in Illustrator which I would like the color fill to match those names/colors from my excel file. Is this possible with an easy script?

There is an Illustrator scripting forum… Hardly anyone in it but it does exist… It 'may' be possible without script… If not it 'should' be possible with script… Look at data sets first…

Similar Messages

  • Script to change fill color based on excel data?

    Hi.  I'm curious if there is a way to change the fill color of, say a rectangle, in Illustrator based on data in an excel spreadsheet (csv or whatever).  For example: say the data in the excel cell is 1 and that corresponds to the rectangle in Illustrator having a yellow fill...  Now say I update the data in the cell to 2 and save.  I run the script and it makes the box red.  Is that even remotely possible?  Thanks.

    Hi, yes it's possible, I used VBA on Windows
    Assuming you have an Illustrator file with 1 square, and 2 swatches named "yellow" and "red"
    this is how I set up the excel file
    type the formula in cell F2 as shown, make your color updates on cell E2
    VBA code:
    Sub recolorSquare()
        Dim iapp As New Illustrator.Application
        Dim idoc As Illustrator.Document
        Dim rect As Illustrator.PathItem
        Dim whatColor As String
        whatColor = range("F2")
        Set idoc = iapp.ActiveDocument
        Set rect = idoc.PathItems(1)
        rect.FillColor = idoc.Swatches(whatColor).Color
        Set rect = Nothing
        Set idoc = Nothing
        Set iapp = Nothing
    End Sub

  • Changing colors in Illustrator--automation

    I have 1500 documents that use black, c0,m0,y0,k50 and 0c,0m,0y,0k as their colors. I want to change the 50k to 100m and the 0,0,0,0 to 100y. When I option drag the new color on to the old color in the swatch pallet, it changes the color in the swatch pallet but not in the artwork itself. Is there any way to get it to change the color in the artwork by editing its original color?
    I can't use the select/same fill color to globally change the color because it only changes the first color. The action recording doesn't pick up that I have selected a new object color to change, so it just changes the same objects again to the second color, completely ignoring the second set of objects that I want to change.
    Very frustrating since Freehand did this out of the box 6 years ago.
    Thanks for help.
    rich

    Here's an AppleScript which does what I think you want.  Copy and paste into a new window in the Apple Script editor and save in Adobe Illustrator CS4>Presets>en_US>Scripts. (or you can just run it from the script editor)
    -- BEGIN CODE
    set fileTypes to {"EPSF", "PDF ", "ART5", "TEXT"} -- file types available to resave as Illustrator
    -- get a sourceFolder that holds the files to resave as AI
    set sourceFolder to (choose folder with prompt "Choose a folder with files to resave as Illustrator:") as text
    -- get a list of files of the defined type in the sourceFolder
    tell application "Finder" to set workingFiles to (every file of folder sourceFolder whose file type is in fileTypes) as alias list
    -- now you have your fileList argument
    -- get a destinationFolder to hold the PDFs
    set destinationFolder to choose folder with prompt "Choose a folder to hold the Illustrator files:"
    SaveFilesAsIllustrator14(workingFiles, destinationFolder)
    on SaveFilesAsIllustrator14(fileList, destinationFolder)
        set destinationPath to destinationFolder as string
        repeat with aFile in fileList
            tell application "Finder"
                set fileName to displayed name of aFile -- get displayed name
                set AppleScript's text item delimiters to "."
                set newFileName to text item 1 of fileName
                set newFilePath to destinationPath & newFileName & ".ai"
            end tell
            tell application "Adobe Illustrator"
                open aFile forcing CMYK with options {update legacy text:true}
                set theList to every page item of current document
                repeat with k from 1 to count of theList
                    if stroke color of item k of theList = {class:CMYK color info, cyan:0.0, magenta:0.0, yellow:0.0, black:50.0} then
                        set stroke color of item k of theList to {class:CMYK color info, cyan:0.0, magenta:100.0, yellow:0.0, black:0.0}
                    end if
                    if fill color of item k of theList = {class:CMYK color info, cyan:0.0, magenta:0.0, yellow:0.0, black:50.0} then
                        set fill color of item k of theList to {class:CMYK color info, cyan:0.0, magenta:100.0, yellow:0.0, black:0.0}
                    end if
                    if stroke color of item k of theList = {class:CMYK color info, cyan:0.0, magenta:0.0, yellow:0.0, black:100.0} then
                        set stroke color of item k of theList to {class:CMYK color info, cyan:0.0, magenta:0.0, yellow:100.0, black:0.0}
                    end if
                    if fill color of item k of theList = {class:CMYK color info, cyan:0.0, magenta:0.0, yellow:0.0, black:100.0} then
                        set fill color of item k of theList to {class:CMYK color info, cyan:0.0, magenta:0.0, yellow:100.0, black:0.0}
                    end if
                end repeat
                save current document in file newFilePath as Illustrator with options {class:Illustrator save options, embed linked files:false, PDF compatible:true, font subset threshold:0.0}
                close current document saving no
            end tell
        end repeat
    end SaveFilesAsIllustrator14
    -- END CODE

  • Script to change colors

    I'd like a Java Script that will allow the user to change character colors in a document using a drop-down menu to select the new color, or a form the user can type the new color into. Has anyone seen anything like this?

    We're setting up a document in which certain elements (folios, drop-caps, etc.) are one color in one month's publication. They change to another color the next month, and so on.
    I'm looking for an efficient way to change all of them.
    My thought was to have a script that would read the colors specified in stylesheets and then allow the user to change the color based on input from a drop-down menu or form.

  • Change color of vector shape in library with AS?

    Hello, I am working on a project that some one else created. There were very orgainized, but my question is this: There is a starburst shape, and in the property inspector it is labeling as yellow burst, and that's how it shows in the library. But one instance of it is red in the movie, and I can not find it to change or delete as they called everything dynamically. Any help on how this was done, or how I might locate this object? thanks

    Thanks, I know you can see there, it was just nested really deep. I found it and saw that it was tinted another color. Did you see my other post about creating a popout window? Thanks again for your fast responses....

  • Underlying Drawing Lines Are Changing Color Under My Shapes

    Hello,
    I just installed DC last week and noticed the transparent shapes I put on our drawings to highlight certain areas are changing the background lines into other colors. I think this is a feature new to DC but a few of our users would like to disable it. Has anyone else had this issue and/or found a solution? I've attached a screen shot below to help with my explanation.
    Thanks,
    Drew

    Others have reported this sort of thing with text/markup annotations. I would encourage you to submit a bug report: Adobe - Feature Request/Bug Report Form

  • Can I change color of a shape

    Photoshop Elements 2:
    I have a Jpeg file that is a black on white drawing. Can I change it to blue on white?

    Ronald,
    There are various ways to colorize a B/W, but the advantage of the Hue/Saturation layer is this: if you want to later change the color, simply double-click the layer thumbnail to bring up the Hue/Sauration box again.
    Another benefit of an adjustment layer (not only Hue/Saturation) is that you can paint the layer with black to reveal the original picture, and paint with white to restore the adjustment. This method works, for example, if you want to colorize just certain portions of your B/W.
    One more thing. If the picture is a true greyscale you will first have to convert it to RGB: Image>Mode>RGB Color
    Mark

  • SQL (Select) based on Excel data

    Hi
    I have accounts & their status in a Excel file (like below)
    Account     status     
    1111     1
    22222     11
    I have like 300 rows in excel file
    (sometimes Account will have only 4digits, in that case I want to append '0' in the front)
    (sometimes status will have only 1/2digits, in that case I want to append '00', if its one digit and '0' if its two digit)
    I want to write a select statement based on those, for example (in this case)
    SELECT * FROM SUPPLIER
    WHERE (Account = '01111' AND Status = '001')
    OR (Account = '22222' AND Status = '011')
    How do I write the select for all 300 rows(in excel) at one time? I don't want to use(create) tables. And I am using Oracle version 9
    Thanks

    Hi,
    I assume this question is just about how to format the numbers, not about directly reading the Ecel file.
    To use different formats in different situations, all in the same column, use CASE to to choose the appropriate format, like this:
    WITH     my_excel_table     AS
    (     -- Begin test data
         SELECT     1 AS n     FROM dual     UNION ALL
         SELECT     22     FROM dual     UNION ALL
         SELECT     333     FROM dual     UNION ALL
         SELECT     4444     FROM dual     UNION ALL
         SELECT     55555     FROM dual     UNION ALL
         SELECT     666666     FROM dual     UNION ALL
         SELECT     7777777     FROM dual
    )     -- End test data, cut here
    SELECT     n
    ,     TO_CHAR     ( n
              , 'fm'     
                ||
                CASE
                   WHEN     n < 1000     THEN '000'
                   WHEN     n < 100000     THEN '00000'
                                  ELSE '9999999999'
                END
              )     AS f
    FROM     my_excel_table
    ORDER BY     n;The code above produces:
             N F
             1 001
            22 022
           333 333
          4444 04444
         55555 55555
        666666 666666
       7777777 7777777As written, this assumes the numbers are all non-negative integers, but it can be modified.
    Message was edited by:
    Frank Kulash
    Sorry if this confused you. I see now that it doesn't really answer your question.
    You can use TO_CHAR separately on the two columns:
    TO_CHAR (account, 'fm00000')
    TO_CHAR (status, 'fm000')
    or use LPAD, as Visu demonstrated.
    Only use these things for display. In the WHERE-clause (and similar places), you can use leading zeros if you like, but do not use quotes, that is, just say "account = 1111" and "status = 1", or, if you prefer, "account = 01111" and/or "status = 001".

  • Automatically renaming pdf files based on excel data

    I am creating pdf certificates using variable data from excel files with InDesign.  This creates a multipage pdf file with a different persons name on each page.  Then end result needs to be individual pdf files named for each person.  I can extract the single pages out of the main pdf ending up with however many files all named the same thing besides a number at the end of the common file name.  Question:  Is there a automated process of renaming the individual files using the data from the excel file?

    You're looking for a PDF Parser or PDF miner tool (PDFminer) as a starting framework, and you'll almost certainly be writing custom code around that as parsing a text file that's effectively free-form and originating from multiple different sources almost always (always?) involves writing customized processing code and an on-going series of tweaks as the suppliers of the PDF change their ticket formats.  (Even apparently-simple details such as the time and date formats, for instance, can vary by geography and language and by supplier, and can derail common processing.)
    In some cases that I can envision, it'd be entirely possible that the data you're after is actually located in an embedded image and not in text that can be parsed.
    The best approach is to get folks to send you JSON or XML or some other format intended for interchange, and avoid the whole mess that is parsing or mining a printer-oriented format.
    The other obvious option is to use something like Amazon's Mechanical Turk or some other explicitly outsourced help.  Depending on how often the formats change and how many of these PDF files you're dealing with and how varied the formats are, sometimes throwing staff at the problem can be the most cost-effective approach.

  • Changing color of columns in CL_GUI_CHART_ENGINE

    Dear Developers,
    I am displaying a Columns Graph using class CL_GUI_CHART_ENGINE. My requirement is to change color of selected columns based on their height. For example if height of the column exceepds 10, then the color of that particular color is to be made red. Is that possible using CL_GUI_CHART_ENGINE ??
    Thanks and Regards,
    kartik

    Hi,
          Refer below link:
    https://forums.sdn.sap.com/click.jspa?searchID=3958197&messageID=2474585
    <b>Reward points</b>
    Regards

  • Bright areas on imported footage change color

    Having just returned from shooting interviews at a trade show, I decided to give FCP X a go. I downloaded the trial version and imported some footage. When I import footage shot on our Sony Z1 (HDV), all areas that are near or over 100 IRE start changing color (as illustrated in this screen shot. Even graphics that are imported with white levels below 100 IRE have colors mixed up (black type turns white, colors invert, etc.)
    When I import the footage into FCP 7, it displays and renders just fine. If I capture the footage in FCP 7 then import into FCP X, I get the same result as shown in the screen shot. It looks like some type of clipping indicator, but I've found nothing that shows it can be turned off
    While further researching the issue, I shot some footage on my Pentax K7 to see what it would do. The results are below. As you can see, anything that should be white (in the backyard) is black, even though none of the whites exceed 100 IRE.
    Interestingly, when I render out the footage, it all looks correct. Is there some kind of clipping indicator overlay function that exists in FCP X, and if so, how do I turn the bloody thing off?
    Thanks in advance!

    See if this thread helps.
    https://discussions.apple.com/message/18564274#18564274

  • Report Designer change color

    I created a report using Report Designer and would like to change color of the field base on the data criteria.
    I want to add code using Report Function, but I am not sure how to enter code there and which language I can use.
    Can you please advise me a example how to do the task?
    Your help and information is great appreciated,
    Regards,
    Iccsi

    Hi,
    it's a setting...
    just select the section you want to change to another place, and then select the tabpage "properties"
    There you have an option : 'position'
    The first section in your report (top of page) has position 1, the second position 2...
    So if you want to swap the last section to the first place, just change the position to 1...
    Ciao!
    Joke

  • How to change colors in 2 different shapes one at the time?

    I have 4 different groups. Every group has 4 different shapes/colors. If i change Group 1 Shape 1 color then I want that Shape 2 in Group 2 color would be automatically same as Shape 1 in Group 1. Is it possible?

    That can be done in Illustrator, if vector-based artwork is a possible alternative.
    Have a look at the concept of a "global color" in Illustrator.
    This concept does not have a direct counterpart in Photoshop. Indexed colour mode comes close—but an image in indexed colour mode can't have layers.

  • ExtendScript Illustrator - Change color of text one character at a time.

    I'm trying to write code for ExtendScript ToolKit to target Illustrator. I've been writing in JavaScript, but am open to switching to AppleScript if needed. The goal of the code is to change the characters in a text box one by one to the color of the image behind that letter. The end goal is to have the color of the text create the image.
    Basically, I select a character. And lets say that character is at 720x648 (in pixels) in a 24x36 in image. Then I detect the color in the image layer at that location. Then turn the selected character to that color.
    I have encountered two problems, finding a way to have the script detect the color of the picture at a given location (ideally in pixels) and then change that one character to that color.
    So far my code is this, with a color hard coded in for testing purposes since I haven't figured out the detection part yet.
    if ( app.documents.length > 0 ) {
    var doc = app.activeDocument;
    //get text from textbox
    var numChars = 0;
    textArtRange = doc.textFrames[0].contents;
    numChars += textArtRange.length;
    //loop through to select characters one at a time
    for (x=0; x<numChars; x++){
         var selectChar=textArtRange.charAt(x)
         doc.characterStyles.removeAll();
         var charStyle=doc.characterStyles.add("NewOne");
         var charAttr=charStyle.characterAttributes;
         var detectedColor = new RGBColor();   //ideally the detected color would go here. But for now it is hard coded.
             detectedColor.red = 242;
             detectedColor.green = 51;
             detectedColor.blue = 51;
         charAttr.fillColor = detectedColor;
         charStyle.applyTo(selectChar); // I got an error here: "Object expected".
    }//end for loop
    To detect the color, I tried using the following code, but it only works in Photoshop and even there I can't find a way to store that color the way I need to.
    app.activeDocument.colorSamplers.removeAll();
    var pixelLoc = [UnitValue(16) , UnitValue(16)];
    var myColorSampler = app.activeDocument.colorSamplers.add(pixelLoc);
    I have put in so many hours into this and just want to rip my hair out. Any help or guidance anyone can give would be SO appreciated! Thanks in advance!!!

    finding a way to have the script detect the color of the picture at a given location (ideally in pixels)
    there's no native command to do this in illustrator,
    I tried using the following code, but it only works in Photoshop.....
    unless you get extremely lucky (working with matching Object names) photoshop code won't work in Illustrator.
    a possible workaround, clip your text to your image, rasterize it, trace it, you might end up with a solid color per character, where you could read their color.

  • How to change the background color of a cell based on other cell background

    Hi,
    Sorry if this is a basic question - I am new to XML. I want to create a table column, with no data in it. I then want to change the background color of the column based on the background color of other columns. I.E.
    - If there are 3 or less cells in this row that are not green, color this cell green.
    - If there are 4 or less cells in this row that are not green, and 3 or less are not red, color this cell yellow.
    - If there are 4 or less cells in this row that are not green, and 3 or more are red, color this cell red.
    If there are 5 or more cells in this row that are not green, color this cell red.
    Many thanks for any assistance.

    Okay - I have this resolved.
    1. Create two variables (Yellow and Red):
    <?xdoxslt:set_variable($_XDOCTX, 'Yellow', 0)?>
    <?xdoxslt:set_variable($_XDOCTX, 'Red', 0)
    2. For each cell, set the background based on their individual traffic light criteria, and update the associated color variable by 1. By default the backgrd color is set to Yellow so I only have to check for the lower and upper bounds:
    <?choose:?>
    <?when:number(CHECKED_IN)<=1?>
    <?attribute@incontext:background-color;'Lime'?>
    <?end when?>
    <?when:number(CHECKED_IN)>3?>
    <?attribute@incontext:background-color;'Red'?>
    <?xdoxslt:set_variable($_XDOCTX, 'Red', xdoxslt:get_variable($_XDOCTX, 'Red') +1)?>
    <?end when?>
    <?otherwise?>
    <?xdoxslt:set_variable($_XDOCTX, 'Yellow', xdoxslt:get_variable($_XDOCTX, 'Yellow') +1 )?>
    <?end otherwise?>
    <?end choose
    3. I now want a cell that is Red if any of the cells in the row is red. Its yellow of there are 3 or more yellow cells in the row, and no reds. Otherwise its green. First, create an empty cell and make the default color green. Then add:
    <?if: number(xdoxslt:get_variable($_XDOCTX,'Red')) > 0?>
    <?attribute@incontext:background-color;'Red'?>
    <?end if?>
    <?if: number(xdoxslt:get_variable($_XDOCTX,'Yellow')) >= 3 and number(xdoxslt:get_variable($_XDOCTX,'Red')) = 0?>
    <?attribute@incontext:background-color;'Yellow'?>
    <?end if?>
    4. Finally, reset the variables for the next row:
    <?xdoxslt:set_variable($_XDOCTX, 'Yellow', 0)?>
    <?xdoxslt:set_variable($_XDOCTX, 'Red', 0)

Maybe you are looking for