Error 21 (change of color on text)

http://forums.Adobe.com/message/5580527#5580527

Carlos wrote a script in response to the above thread. He replaces CMYK black and grey black a shade called "black point". It's great, but it seeks only to paths. I made a few adjustments to keep it to make white objects and unpainted. I'll need to work on the text and degraded. Right now I'm working on the text.

I tried to use the same logic that runs on the paths on the text, but I'm missing something. Help help.

Screen Shot 2013-08-13 at 9.39.43 AM.png

It is the last version to work, do it not text or gradients.

// script.name = cmykBlackNgrayscaleToSpotBlack.jsx; 
// script.description = changes art color from standard CMYK Black and Grayscale tones to an EXISTING Spot swatch named "spot black";
// script.requirements = an opened document;
// script.parent = CarlosCanto // 08/08/13;
// script.elegant = false;

// reference http://forums.adobe.com/thread/1267562?tstart=0

// Note: color values get rounded to the nearest integer, to avoid values like black = 99.99999999999999
//            Hidden and/or Locked Objects will be ignored, as well as objects in Hidden and/or Locked Layers

#target Illustrator

var idoc = app.activeDocument;
var pi = idoc.pathItems;
var sw = idoc.swatches["spot black"];
var fcounter = 0;
var scounter = 0;

for (j=0; j<pi.length; j++) {
    var ipath = pi[j];
    if (ipath.layer.visible==true && ipath.layer.locked==false && ipath.hidden==false && ipath.locked==false) {
        var fillColor = ipath.fillColor;
        if (fillColor.typename == "CMYKColor") {
            if (isColorBlack (fillColor)) {
                var fillk = Math.round(fillColor.black);
                cmykBlackToSpot (ipath, true, false, fillk);
                fcounter++;
            }
        }
        else if (fillColor.typename == "GrayColor") {
            if (grayNotWhiteOrClear (fillColor)) {
                var fillk = Math.round(fillColor.gray);
                cmykBlackToSpot (ipath, true, false, fillk);
                fcounter++;
            }
        }

        var strokeColor = ipath.strokeColor;
        if (strokeColor.typename == "CMYKColor") {
            if (isColorBlack (strokeColor)) {
                var strokek = Math.round(strokeColor.black);
                cmykBlackToSpot (ipath, false, true, strokek);
                scounter++;
            }
        }
        else if (strokeColor.typename == "GrayColor") {
            if (grayNotWhiteOrClear (strokeColor)) {
                var strokek = Math.round(strokeColor.gray);
                cmykBlackToSpot (ipath, false, true, strokek);
                scounter++;
            }
        }
    }
}
alert(fcounter + ' Fill(s) & ' + scounter + ' stroke(s) processed');

function cmykBlackToSpot (path, fill, stroke, k) {
    if (fill) {
        path.fillColor = sw.color;
        path.fillColor.tint = k;
    }
    if (stroke) {
        path.strokeColor = sw.color;
        path.strokeColor.tint = k;
    }
}

function isColorBlack (cmykColor) {
    var c = Math.round(cmykColor.cyan);
    var m = Math.round(cmykColor.magenta);
    var y = Math.round(cmykColor.yellow);
    var k = Math.round(cmykColor.black);

    if (c==0 && m==0 && y==0 && k != 0)
        return true
    else
        return false
}
function grayNotWhiteOrClear (GrayColor) {
    var pct = Math.round(GrayColor.gray);

    if (pct != 0)
        return true
    else
        return false
}

It is the version I'm working now where I am trying to include the text.

// script.name = cmykBlackNgrayscaleToSpotBlack.jsx; 
// script.description = changes art color from standard CMYK Black and Grayscale tones to an EXISTING Spot swatch named "spot black";
// script.requirements = an opened document;
// script.parent = CarlosCanto // 08/08/13;
// script.elegant = false;

// reference http://forums.adobe.com/thread/1267562?tstart=0

// Note: color values get rounded to the nearest integer, to avoid values like black = 99.99999999999999
//            Hidden and/or Locked Objects will be ignored, as well as objects in Hidden and/or Locked Layers

#target Illustrator

var idoc = app.activeDocument;
var pi = idoc.pathItems;
var sw = idoc.swatches["spot black"];
var ch = idoc.textFrames[0].characters[0];
var fcounter = 0;
var scounter = 0;

for (j=0; j<pi.length; j++) {
    var ipath = pi[j];
    if (ipath.layer.visible==true && ipath.layer.locked==false && ipath.hidden==false && ipath.locked==false) {
        var fillColor = ipath.fillColor;
        if (fillColor.typename == "CMYKColor") {
            if (isColorBlack (fillColor)) {
                var fillk = Math.round(fillColor.black);
                cmykBlackToSpot (ipath, true, false, fillk);
                fcounter++;
            }
        }
        else if (fillColor.typename == "GrayColor") {
            if (grayNotWhiteOrClear (fillColor)) {
                var fillk = Math.round(fillColor.gray);
                cmykBlackToSpot (ipath, true, false, fillk);
                fcounter++;
            }
        }

        var strokeColor = ipath.strokeColor;
        if (strokeColor.typename == "CMYKColor") {
            if (isColorBlack (strokeColor)) {
                var strokek = Math.round(strokeColor.black);
                cmykBlackToSpot (ipath, false, true, strokek);
                scounter++;
            }
        }
        else if (strokeColor.typename == "GrayColor") {
            if (grayNotWhiteOrClear (strokeColor)) {
                var strokek = Math.round(strokeColor.gray);
                cmykBlackToSpot (ipath, false, true, strokek);
                scounter++;
            }
        }
    }
}

for (t=0; t<ch.length; t++) {
    var txt = ch[t];
    if (txt.layer.visible==true && txt.layer.locked==false && txt.hidden==false && txt.locked==false) {
        var fillColor = txt.fillColor;
        if (fillColor.typename == "CMYKColor") {
            if (isColorBlack (fillColor)) {
                var fillk = Math.round(fillColor.black);
                cmykBlackToSpot (txt, true, false, fillk);
                fcounter++;
            }
        }
        else if (fillColor.typename == "GrayColor") {
            if (grayNotWhiteOrClear (fillColor)) {
                var fillk = Math.round(fillColor.gray);
                cmykBlackToSpot (txt, true, false, fillk);
                fcounter++;
            }
        }

        var strokeColor = txt.strokeColor;
        if (strokeColor.typename == "CMYKColor") {
            if (isColorBlack (strokeColor)) {
                var strokek = Math.round(strokeColor.black);
                cmykBlackToSpot (txt, false, true, strokek);
                scounter++;
            }
        }
        else if (strokeColor.typename == "GrayColor") {
            if (grayNotWhiteOrClear (strokeColor)) {
                var strokek = Math.round(strokeColor.gray);
                cmykBlackToSpot (txt, false, true, strokek);
                scounter++;
            }
        }
    }
}
alert(fcounter + ' Fill(s) & ' + scounter + ' stroke(s) processed');

function cmykBlackToSpot (path, fill, stroke, k) {
    if (fill) {
        path.fillColor = sw.color;
        path.fillColor.tint = k;
    }
    if (stroke) {
        path.strokeColor = sw.color;
        path.strokeColor.tint = k;
    }
}

function isColorBlack (cmykColor) {
    var c = Math.round(cmykColor.cyan);
    var m = Math.round(cmykColor.magenta);
    var y = Math.round(cmykColor.yellow);
    var k = Math.round(cmykColor.black);

    if (c==0 && m==0 && y==0 && k != 0)
        return true
    else
        return false
}
function grayNotWhiteOrClear (GrayColor) {
    var pct = Math.round(GrayColor.gray);

    if (pct != 0)
        return true
    else
        return false
}

This is a test file

https://docs.Google.com/file/d/0BzEoJSYDhH_WdENjc092SF9GN0U/edit?USP=sharing

Thanks for playing.

Carlos, you are right about that. I had a knot of logic that it impossible to work on the text in groups AND directly on the layers at the same time. I ended up using a version that did not use your difficulty, even if it was viable.

Here's my final script. Works like a charm. Thanks for all the help.

// script.name = BlackToSpotBlack.jsx;
// script.description = changes art color from standard CMYK Black and Grayscale tones to a Spot swatch named "spot black";
// script.requirements = an opened document;
// script.parent = CarlosCanto // 08/08/13;
// script.elegant = false;

// reference http://forums.adobe.com/thread/1267562?tstart=0 && http://forums.adobe.com/message/5610447#5610447

// Note: color values get rounded to the nearest integer, to avoid values like black = 99.99999999999999
//              Hidden and/or Locked Objects will be ignored, as well as objects in Hidden and/or Locked Layers

#target Illustrator

var idoc = app.activeDocument;
var pi = idoc.pathItems;
var tf = idoc.textFrames;
createSpotBlack();
var sw = idoc.swatches["spot black"];
var fcounter = 0;
var scounter = 0;
var gcounter = 0;

//apply spot to paths and gradient stops
for (j=0; j 
         

Tags: Illustrator

Similar Questions

  • Change the color of text for the hyperlink in the Blog module

    How to change the color of text for the hyperlink in the Blog module?  I tried to add the code:

    text-decoration: none;

    in the HTML code, but maybe I only am not inserted correctly.

    Any ideas?

    Thank you!

    Hi Casey,.

    Make sure also that you have nothing referring to the color attribute in your CSS.  For example on my test site screen.css control it is here an example of using Firebug to find this.

    If still stuck and specify the site and help further.

    Kind regards

    -Sidney

  • How partly change the color of text in OutputMessage?

    We could change color OutputMessage via the parameter "textColor". But it changes the entire message. Is it possible to paint a portion of a message for example in red and the other green? In other words, is it possible to change the color of a common string?

    Kind regards

    Max

    Hi Max,.

    There is only a single property for the text color, and it applies to the message the entire production.  I'm sure that there is no way to split the message in different colors.

  • Change the color of text Cluster

    I need to change the color (text or backgroung) of an individual in the cluster of 8 positions index.

    I make a test with 8 different results and at the end of each result, I need to change the RED color to fail or green to go. I have a result Boolean cluster of 8 positions (T = pass) and F = Fail and I have another post 8 text cluster to change the background color or text.

    Thanks to you all

    Here's a method using text blocks.  As Raven Fan said, you can use the Boolean values (can be personalized if you don't like the default appearance) which have the desired appearance.

  • Change the color of text screen

    I am a user of Windows 8 and the text on my screen is white. How can I change the color?

    I'm trying to change the color of the text on my desktop...

    Hi Kenneth,

    You cannot change the font color of desktop.

    Because desktop wallpaper images have different colors, it is easy for the colors of unreadable fonts if they are on top of the same color in a background image to display. For example, a black font on top a dark part of the background image or a white font on a white part of a background image.

    The desktop icon fonts are dynamic and show white on dark background and change in white with a shadow effect black on a light background.

  • How can I change the color of text selection when you edit a pdf file?

    I was fussing around with preferences in Adobe Acrobat Pro XI (Mac version) and off the selected text color when the text selection. I don't know what preference I changed and can't seem to find a second time to restore the color of text selection. Usually, in Adobe Acrobat Pro XI, when the selection of text (note: NOT the text stressing the function), AAP XI has a color to the selected text.  This preference restaurantrare the saltsummer color of the text when you use the selection tool i-beam appearing to the left of the hand tool?

    Screen Shot 2016-02-15 at 1.54.46 PM.png

    Now, it simply displays the text selected, as shown in the figure below.

    Screen Shot 2016-02-15 at 1.54.33 PM.png

    Once again, please, note that I don't watch highlight tool 3rd from the left in the picture below.

    Screen Shot 2016-02-15 at 1.52.34 PM.png

    My guess is it is something under Edit - Preferences - accessibility, possibly the "high contrast colors" option, or 'always use the system selection color. "

  • CC 2015.1 error when changing Active color

    Since the update, whenever I try to change the active color I get the generic error "could not complete your request because of a program error." In this case no matter how I try chnge color, as well as if I select a built-in tool that automatically changes the color. Funny it is, the color desired is active, but does not update the display of the active palette. What makes techincally functional, but it is still an inconvenience to have to erase the error every time I change my active color.

    The error will NOT occur when I change the secondary color, but it happens when I flip through active/secondary.

    This is only happening on my work computer Win8; my portable home Win10 had no problems since the update.

    Any ideas?

    Hi mpbMKE,

    Sorry for the mistake. These program errors can be caused randomly and generally it is not a reason known for them.

    A fix for it is usually to reset the Photoshop preferences: es.html #Preferences blogs.adobe.com/crawlspace/2012/07/photoshop-basic-troubleshooting-steps-to-fix-most-issu

    Give that a try and let us know how it goes.

    Concerning

    Pete

  • How can I change the color of text mask?

    I'm trying to animate text in Adobe After Effects and I created a text mask. Default white is the color of the font. I can't change the color of the text. Can someone point me in the right direction? Thank you!

    You change the color of the solid on the basis of the parameters of the layers window or apply any colorizing effect you like.

    Mylenium

  • Change the color of text button overview

    Hello

    I used text buttons in my project and I want to change the color of overview. How can I do?

    I couldn't find anything in the style!

    Thank you

    Buttons text takes up the style of the buttons system, you can't control them at all.

    Best way would be to replace the text by form buttons buttons, which you can style so that they perfectly resemble text buttons, but you can control the style of the three States. I recommend to do with the object Style (on CP8) Manager.

    Transparent buttons don't have any rollover State, you can also use image buttons but then you must create three different images with proper nouns, such as image buttons you have included in the CP.

  • change the color of text blocks only the active layer

    Well my script to change the color of the text frame changes the color of all the blocks of text hidden or not.

    I need to change only the visible text blocks.

    If (app.documents.length > 0) {}

    newCMYKColor = new CMYKColor();

    newCMYKColor.black = 0;

    newCMYKColor.cyan = 0;

    newCMYKColor.magenta = 0;

    newCMYKColor.yellow = 0;

    for (i = 0; i < app.activeDocument.textFrames.length; i ++) {}

    textArtRange = app.activeDocument.textFrames [i] .textRange;

    textArtRange.characterAttributes.fillColor = newCMYKColor;

    }

    }

    Any ideas on how the way only change the color of the text on the active layer blocks? In the final script I want to hide all other layers so if it could be done by a visible attribute more easily that would work just as well.

    Thank you

    Duane Leach

    Hello

    It will work for you?  Have not tested much beyond text blocks in groups and those who are just stand-alone on the layer.

    If (app.documents.length > 0) {}

    var thisDoc = app.activeDocument;

    newCMYKColor = new CMYKColor();

    newCMYKColor.black = 00;

    newCMYKColor.cyan = 40;

    newCMYKColor.magenta = 50;

    newCMYKColor.yellow = 50;

    Need to retrieve blocks of text within the groups on the layer.

    var artSel = thisDoc.activeLayer.groupItems;

    for (i = 0; i<>

    If (artSel [i] .hidden == false) {}

    var text = .textFrames artSel [i];

    for (j = 0; j<>

    text [j].textRange.characterAttributes.fillColor = newCMYKColor;

    }

    }

    End to change the rest of the outside groups text boxes.

    var textArtRange = app.activeDocument.activeLayer.textFrames;

    for (k = 0; k<>

    If (textArtRange [k] .hidden is false)

    textArtRange [k].textRange.characterAttributes.fillColor = newCMYKColor

    }

    on the other

    Alert ("it is not any open documents to change...");

  • Cannot change the color of text-related

    PC, windows 7, InDesign CS5

    Hello

    Sorry if this has developed before, but I couldn't find in searches.

    I have a few blocks of text with linked text and I want to use the selection tool to select all images and change the color of the text, but the options to choose the 't' in the color and swatches palettes are grayed out and won't let me select them.

    I can click within one of the frames and to select all of the text and change the color in this way, but I have a lot of columns in text boxes with several different sets of links that is, I have to go into each separate set of related images and change the font color for each game that will take a long time.

    Is it possible to select all images on my page, no matter what they are double and change the color of the text in?

    Thanks in advance

    C

    Jongware said, you can use find/replace to some pretty powerful things. Perhaps if you gave us a more clear example of what you have and what you want, we can offer some advice on its use. Do you want to apply the same style to everything in the thread? It would be very easy (and it's probably already done - most docs start out by evrythig [standard paragraph] style.)

  • Change the color of text adio component

    How can I change the color of the text of a radio button?

    large.

    Please mark this thread as answered, if you can.

  • static_text change the color of text to the flight hover/rollover?

    Hello

    If you have a look at export to Facebook plugin by Jeffrey Friedl, its Plugin Info dialog box includes static_text items that change color when the mouse passes over them.  A while back I posted on initiate an action when a user clicks on an element of static_text.  He used this to inidcate when static_text elements are interactive, and I want to do it too.  Unfortunately, Jeffrey is unable to talk about it.

    Someone (Eric?) can do the light on this field should be added to static_text to do this?  I know how to turn clicks left and right of the mouse on an item of static_text but have not figured out how to react to the other mouse events yet.

    Thank you

    Matt

    WARNING: What you see here is undocumented, unsupported, could shatter at any moment, should not be used to control the core functions such as the landing of aircraft, blah, blah blah, etc. etc.  Use at your own risk - it is for you to make it work.  I have no recollection of ever typing this, so can not be held responsible. 

    Phew!  In any case, a few months ago, I asked Jeffrey Friedl the same question.  His answer:

    I asked (and was given) authorized to tell you:

    {static_text: f}
    title = 'Visit the Site',
    MOUSE_DOWN = function()
    LrHttp.openUrlInBrowser (someUrl)
    end,
    [WIN_ENV and 'adjustCursor' or 'adjust_cursor'] = function()
    Recorder: debug ('mouse_over handler activated')
    end,
    appears = LrColor (0, 0, 1),
    }

    Enjoy!

    When asked if I could share information, he replied:

    Approval did not come with restrictions, so I guess it's normal to
    spread around.

    In any case, the critical part of the code snippet that is missing is what to do in the «mouse_over Manager» feature  What I did to all of my links was to call a common function that would launch an asynchronous task that could change the color of the link, then change it after some time.

    I went 'self' (static_text being flown over) to my current routine, so he could follow the active link and reconnect precedent, when the user is pointing somewhere new.

    Good luck and, as Jeffrey says: Enjoy!

    -Don

  • Change the color of text on the button click

    I found many ways to fill out / change the box around a field (both types) but not a way to change the color of the font.

    I tried:

    Form1. Page1.wTextField1.TextColor = ['RGB', 0.5,0.5, 0];

    Form1. Page1.wTextField1.textColor = color.black;

    All hope?

    Try

    Form1. Page1.wTextField1.font.fill.color.value = "0,0,0";

    Steve

  • How to change the color of text title of region?

    Hello

    I use Apex 4.2 and have made a copy of the 'Easy Red' out-of-the-box theme. For all of my parts, I used the ' form ' or "Region of reports" as the type of model. When I initially set them, the title of region appeared in white text, which is what I'm asking. However, after reconsideration, I see all the titles of the region changed to a black color. I don't know what caused this, but can someone please suggest the best way to make that change to white in one place is considered throughout my application?

    I looked into the parameters of the models of the region and in the "Définition" section I can see that it uses "rc-gray-high" and/or "rc-title" css style class. Firebug, I think I can see that the font color is inherited from the class 'rc-gray-top '. I wonder how I can change the classes or even if I have to in order to achieve what I'm after.

    Thank you

    In my view, what is using DEV Ap3x<>

    For projects with several changes, I recommend the use of .css file, but you can also put your CSS in a dedicated field.

    Open the relevant page templates, cascading style sheet-> Inline

    Open Help for the attribute for more information. No marking necessary, just the CSS.

Maybe you are looking for