Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Illustrator Color chaning script?

New Here ,
Aug 07, 2016 Aug 07, 2016

Hello community! I have around 600 files that I need to change the colors from dark green/light green to dark blue/light blue and I need a script for that. There are some simple letters divided in half and all I need is the upper part to be dark blue instead of the dark green and the lower part to be light blue instead of the original light green. Is this possible? I'm using windows 10 as my operating system. Any help is much appreciated!

Regards,

David.

TOPICS
Scripting
1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Participant , Aug 07, 2016 Aug 07, 2016

This code will have you select a folder and then loop through all the files with .EPS file extensions.
Note that this script assumes that all of the colors are exactly the same two greens as in that example file you sent.

You will need to replace the RGB values for the top colors in the lines marked "<- Here" with the values for the new blue colors.

function ConvertColors() {

   

    /* REPLACE THESE RGB VALUES */

    var topColor = new RGBColor();

   

    topColor.red = 0;    // <- HERE

    topColor.g

...
Translate
Adobe
Community Expert ,
Aug 07, 2016 Aug 07, 2016

Hi DavidTiberiu​,

how the letter is divided in half?

The letter still a letter is? Or it's more a (two) path(s) (compound paths) ?

The new colors already exists in the documents?

Do you have an example file for us?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Aug 07, 2016 Aug 07, 2016

Anything is possible (almost) if you put your mind to it! Now attach an example file and let's see what you got!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 07, 2016 Aug 07, 2016

Here is an exampleJC.jpg

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 07, 2016 Aug 07, 2016

And now this is a shape not a letter anymore, sorry for being so confusing with my original message. The main idea is that I want the top dark green to be a dark blue #2E3192 and the bottom part to be a light blue #29ABE2 also the "Company name" to be same dark blue #2E3192 . Thank you so much!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 07, 2016 Aug 07, 2016

This could be easy or difficult, because of: there are more elements with the same color exists.

The main question is: how to identify the elements to changing? Always on the top or at an several layer or, or or …

And: Do you have an example file (and not an example picture) ?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 07, 2016 Aug 07, 2016

Sure, i've attached the file below

http://www.filedropper.com/ha

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 07, 2016 Aug 07, 2016

Is this something that can be done? Or at least to brake it down in 2 scripts, or in some way that will make my job easy somehow...Thank you so much for you help community, really appreciate all your answers until now!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 07, 2016 Aug 07, 2016

Is there a fix rule to indentify the items which should be recolored? I dont' think. IMHO are different path types with different numbers of items.

One possible way: Recolor all green items (paths, compound paths and group items) to blue and all light green items to light blue.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 07, 2016 Aug 07, 2016

This code will have you select a folder and then loop through all the files with .EPS file extensions.
Note that this script assumes that all of the colors are exactly the same two greens as in that example file you sent.

You will need to replace the RGB values for the top colors in the lines marked "<- Here" with the values for the new blue colors.

function ConvertColors() {

   

    /* REPLACE THESE RGB VALUES */

    var topColor = new RGBColor();

   

    topColor.red = 0;    // <- HERE

    topColor.green = 0;    // <- HERE

    topColor.blue = 255;   // <-HERE

   

    var bottomColor = new RGBColor();

   

    bottomColor.red = 255;   // <- HERE

    bottomColor.green = 0;   // <- HERE

    bottomColor.blue = 0;  // <- HERE

   

    /* ~~~~~~~~~~~~~~~~~~~ */

   

    // we'll just use the Red value of the top to identify which color we have

    var oldTopColor = 140;

   

    var dir = Folder.selectDialog("Where?");

    var files = dir.getFiles("*.eps");

    // loop through all the files in the selected directory

    for(var f = 0; f < files.length; f++){

        var doc = app.open(files);

       

        // loop through all paths and change the colors based on current fill

        var paths = doc.pathItems;

        for( var i = 0, ii = paths.length; i < ii; i++ ) {

            var curPath = paths;

           

            // check the fill color to see if it has the same Red value as the old top color

            if( curPath.fillColor.red == oldTopColor ) {

                curPath.fillColor = topColor;

            }

            // if not it must be the bottom color

            else {

                curPath.fillColor = bottomColor;

            }

        }

       

        // close and save the changes

        doc.close(SaveOptions.SAVECHANGES);

    }

}

ConvertColors();

Hope this helps!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 07, 2016 Aug 07, 2016
LATEST

It worked! I LOVE YOU! Really, you saved me!!!! A million times thank you!!!!!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines