Replace the color via color chart

Hello

I just need to find objects, texts or anything like that on the page have value of shades of color C = 0 M = 0 Y = 0 K = 100 in "black".

Below is the code I tried, is not find color 'Black' in the list of swatch.


var doc = app.activeDocument;  
var item = doc.pageItems;  
var col = doc.swatches.getByName('Black');      
for(var i=0; i<item.length; i++){  
         if(item[i].fillColor.spot.color.cyan == 0 && item[i].fillColor.spot.color.magenta == 0 && item[i].fillColor.spot.color.yellow == 0 && item[i].fillColor.spot.color.black == 100){  
                item[i].fillColor.spot.color == col;}     }



Not sure why it does not apply. He is doing well if the color is in process mode.

if(item[i].fillColor.cyan == 0 && item[i].fillColor.magenta == 0 && item[i].fillColor.yellow == 0 && item[i].fillColor.black == 100){  
             item[i].fillColor == col;}  

Thank you

Kitty

Hello Kitty,

Oh, my mistake, I think it happens because run you code when the strokeColor of the element is not a SpotColor, try to check it before, by using an 'If' structure like this:

for(var i=0; i

Maybe it's work!

Kind regards

Vinicius-

Tags: Illustrator

Similar Questions

  • HP Envy 5530: HP Envy 5530 told to replace the color cartridge, even after replacing with a new one.

    HP Envy 5530 said to replace the color cartridge, even after replacing with a new one.  Printer is 1 year old and I replaced the cartridges several times over the past year.  I am enrolled in the program of HP ink.  I can run the printer mode single cartridge using a black ink only and it works with my pc XP, Ipad, Chrome pc and mobile phone.  My pc win 8.1 will not print anything other than a test page.  Printer on the pc file lists always attention required when you try to print from the pc win 8.1.  I believe that the problem may be related to surface of cartridge for printing inside the HP envy heads 5530.  This part is available for purchase, and if so, where?

    I found a work around.  On the pc win 8.1, it seems that the print request must see a reset of the HP envy 5530 to print mode single cartridge.  I just start the pc and then reset the printer by lifting the hatch for the print heads.  That's all.  Once this is done, the 'attention required' message goes to the loan and it is able to print.  It will open a window, which suggests you add the color cartridge, but it will disappear when printing.  Simply open the door once and you can print until you turn off the pc.

  • A jpg still print with white lines spaced, but I replaced the color cart.

    A jpg still print with white lines spaced, but I replaced the color cart. Please notify. Thanks in advance.

    Hello

    That's what I feared. This kind of banding appears in images when using normal paper for use with low quality settings. You can try to increase the quality of the prints or try using photo paper.

    A good document to make booklets with photos is the HP brochure and flyer. (C6818A)

  • Record the color chart of model

    I created a shade of reason and (apparently) registered, but when I try to open it from another document, can't find it. If I search my hard drive I don't is not, even if I have (several times) saved in the folder of the color chart. Any tips? CS6/Mac

    You should be able to find them in def...

    But you can also load the browsing the other library > and select an Illustrator document that has the desired shade.

  • Cannot drag and drop a pattern to the color chart

    I have a PC with Windows 10 so maybe that's part of the problem.

    I've been working with a very detailed model and using the function drag / move in the color chart with no problems.  Then all of a sudden it stopped working.  Any thoughts?  I can drag and drop other items in, but not this model more.  Any thoughts?

    Try and select the object complete, then object > model > done. This can generate a more descriptive error message. Will there be a clipping mask in your work?

  • the color chart "load" command does not in InDesign 2014 and 2015

    The "load the color chart" command in the Panel color chart does not in InDesign 2014 and 2015. Cannot click the Pantone or any other collection, they are all faded.  I have already trashed the Preferences folder and restarted ID and Mac. It started only once I have updated to the latest version of CC, but now it affects 2014 and 2015.  Don't know what to do, I don't like reinstalling one or the other.  Tried to go back to the CS6.  All solutions anyone?  Thank you!

    Screenshot 2015-07-20 13.14.21.png

    Color chart of load control is for loading samples from other documents or a swatch file.

    Use the new swatch command to add a color.

  • Replace the color of the black icon

    Hello

    I am a photoshop newbster and I'm faced with a pretty easy problem: I would like to replace the icon below color with another color (say green).

    I tried both methods I found on the web:

    1. Replace Color tool-> does not work with black

    2. use the magic wand to make a selection, then the paint bucket to fill the new color. Yes, it looked like a 2-year-old called on the phone.

    Can you provide me with a few steps to replace the color on this icon, so it looks decent?

    Thank you!

    Phone.png

    You have luck with this image, because it's on a transparent background. At the top of the layers palette (next to the word Lock) click the grid icon. This locks the transparency. Then just choose your color and paint on the entire Web. Only the pixels that already had the color will pick up the new color, and they will retain the same level of transparency they had in the dark.

  • I use CS3 AI... .the color chart menu DISAPPEARED

    I use CS3 AI... .the menu of color chart has DISAPPEARED, even if the color chart is check under the WINDOW. ALL that is there is now a red slash... According to the usual 'help' was totally useless.

    Here's the screenshot: how in hell do this back?

    Thanks in advance,

    Carl S.

    AI-SCREEN.jpg

    Open a raster file is mainly the reason why there is no nuance in a file.

    If you want to have shades in a file from the beginning: you must create a new file and then place the raster in her file.

    But you can also simply load or create samples later.

  • I downloaded InDesign and cannot load the color chart - they are greyed out.

    I've now loaded and uninstalled ID CC twice.

    I also reset my prefs in the cloud.

    The color chart is grey and when I go to load, it goes into a doc file and not the Adobe application folder. Photos below.

    greyedout.jpgwrongfolder.jpg

    Please do not hesitate to send me an email and or call [personal information deleted by Moderator]. I'll be outside a lot today but it will end in a different program.

    O

    I think you misunderstand load swatches command.

    .Acb files that appear dimmed are books of color and they are already installed. Instead of load swatches, use new shade of color, you can choose a book of color in the color Mode menu:

    Color chart of charge is used to load a set of shades from a .ase file saved from an Adobe application or other document of identity.

  • Replace the color dialog bug?

    The dialog box redefine does not replace the color of objects filled or rubbed with pure black, CMYK or RGB. (Yes, the Recolorier Art selected checkbox). The dialog box replace any other color but not black. Not even a manually created intense black. Manually by selecting another color in the color or Swatches Panel changes it from bottom or edge of the object.

    This happens both CS6 and CS5 on Windows 7 x 64. I reported it as a bug on the site in version beta, but I wonder if anyone has any info on this. Also do not know if bug reports are always read for the final version.

  • Read the values of color to the color chart of InDesign CS5, js

    Hello

    I need to read the values of color to the color chart. I got this to OMV and hoped he would give me an array of color values for all existing shades, but I get only "color of the object":


    mySwatches = myDoc.swatches [1] .getElements ();


    Alert (mySwatches)

    Thank you for your help.

    Yulia

    I have it. Works very well.

    Thank you.

  • HPoffice jet pro 6830: replace the color of ink

    Do I have to replace all the cartridges.  How can I kno whwich color came out, if I don't want to replace all the cartridges?

    You can determine which cartridge needs to be replaced by checking ink levels estimated from the printer control panel. To do this, start at the home screen and press the Ink Information - this icon should look like a drop of ink.

    Here is a step by step guide on how to replace the ink for this model: LINK

  • HP 3050 printer prints not clearly even after replacing the color and black cartridges...

    I have a problem on a HP 3050 printer all-in-one that is just a year old.  The printer is not used for several months and it was working properly before.  I tried to print a page and had missing horizontal print, I tried to clean the print heads and it did not help.  I replaced the cartridges with new ones and noticed that the ink levels showed that had the old cartridges.  Black was half full and the color was full.  It wasn't new purchased in-store cartridges refills.

    I tried to force an alignment page on the maintenance of the printer screen and this failed repeatedly, undetected alignment page.  I did some research and even tried to clean links them / connectors than cartridges fits.  Looks like that leaving the cartridges for several months in the printer was bad and that I'll need to ge a new printer.

    Thanks for the tips,

    plarr

    document here can help to solve the problems of print quality in your Deskjet 3050 has. I also suggest to clean the cartridge and printer electrical contacts as described in this document (for another series of cartridges, but same principle).

  • Printing printer Lexmark 2600 problems - it prints half a line after replacing the color cartridge

    It prints half a line, if the top or the bottom of it and the cutting of the other party.  This happens on every third line.

    This started happening when I replaced a color cartridge and ran the alignment page.  Before replacing the cartridge, it prints very well (except that the color cartridge started missing).   When I noticed what was going on, I took both cartridges on and then put them back in and had to print the alignment again page.  Yet the problem persists.
    I checked the Device Manager, and my drivers are up to date.  I also checked all connections.
    Any suggestions are welcome.

    Oh boy.  I don't know what I thought.  It just had to unplugging everything & then reconnect them, turn off & on.  This took care of it - seems so simple now.

    I guess it was my new laptop which has the printer all confused.  Win7, my find of CL.

    Insofar as the Lexmark support, I have not yet that day.  In any case, it comes to X 2690 model I had for centuries, so I guess that support would be of any help.  I mean, the guarantee missed a long time ago.
    Thank you for taking the time to answer.
  • By default the color chart - can they be changed?

    The vast majority of my work in InDesign requires that I have colors of our company responsible as swatches to select various elements. I did a file .ase containing only these colors. What I would really like to do now is to include it in my color chart by default so that new document I create will already have them loaded, instead of having to load them separately.

    Is this possible? If so, how should I do this?

    I use the ID CS6 v8.0.2 on a Win7 sp1 machine.

    Thank you!

    Susan

    Load them without opening the files. All future files you create will get them.

Maybe you are looking for

  • Can't access my files. to open local files, but none showed

    I moved my profile to a HD with more space (and one that has been shared on my network) because I had too little space on my boot drive. Now, when Thunderbird opens, I get a screen with a tab saying Thunderbird Mail - local folders, but the folders p

  • Satellite C55D - A - 15 H - videos trolling, take a break and come our fuzzy

    Hello I recently bought a TOSHIBA Satellite C55D - A - 15 H and whenever I play a video it is freees, gal, breaks or fate blurred! I need help. message away

  • I forgot password of icloud forever

    Salvation; I lost my password to iCloud and no way I am able to restore. Our country does not have Apple Bank. My iphone 5s can be used?

  • X 230 no visible fingerprint reader

    Hi *. my Lenovo X 230 (2320-2LG) has a reader of fingerprints on it, but it is not visible in Windows (Windows 8 x 64, clean install). I installed the software, ThinkVantage Fingerprint ("patch" included), no luck. I tried to find something in the BI

  • How to clear the web activity

    OK im trying to erase or delete web on the family safety activity, because I have a lot of things and I don't know how can somebody please thatnk you...