Selection of objects from the fill color

Hi guys

Is possible to select a color to CMYK using JavaScriptobject?

I want to group multiple objects with the same fill color.

Thank you very much for your time...

Please see the picture below...

2.jpg

Hello Puthoskey any good?

Well, I wrote something like what I said, notes:

This code works just to PathItems;

Just CMYKColor;

You must select a pathItem before running the script.

Read selected item fillColor and a loop in all pageItems document, if the pageItem is a pathItem and having the same fillColor or strokeColor, it will be grouped with others;

If you want to do it in other objects like textItems, you must follow the same logic;

Try, test and enjoy, contact us for more rule.

function selSameColor (){

    if(app.activeDocument.selection.length == 0){alert('Select a pathItem.'); return};
    if(app.activeDocument.selection.length > 1){alert('Select just one pathItem.'); return};

    var selFillColor = function(){

        var groupColor =  app.activeDocument.groupItems.add();

        if(app.activeDocument.selection[0].typename == 'PathItem'){
        var colorSel = new CMYKColor;
        colorSel.cyan = app.activeDocument.selection[0].fillColor.cyan;
        colorSel.magenta = app.activeDocument.selection[0].fillColor.magenta;
        colorSel.yellow = app.activeDocument.selection[0].fillColor.yellow;
        colorSel.black = app.activeDocument.selection[0].fillColor.black;
        }else{alert('This is not a pathitem.'); return};

        var itemsLength = app.activeDocument.pageItems.length;
        var items = app.activeDocument.pageItems;

        for (i = 0; i < itemsLength; i++){ 

            if(items[i].typename == 'PathItem'){ 

                if(items[i].fillColor.cyan == colorSel.cyan && items[i].fillColor.magenta == colorSel.magenta && items[i].fillColor.yellow == colorSel.yellow && items[i].fillColor.black == colorSel.black){
                    items[i].moveToBeginning(groupColor);
                }else if(items[i].strokeColor.cyan == colorSel.cyan && items[i].strokeColor.magenta == colorSel.magenta && items[i].strokeColor.yellow == colorSel.yellow && items[i].strokeColor.black == colorSel.black){
                    items[i].moveToBeginning(groupColor);
                };
            };

        };
    if(groupColor.pageItems.length > 0){groupColor.selected = true};
    };

    selFillColor ();

};

selSameColor ();

I hope this useful, see ya soon man.

Best regards

-Vinícius Baptista

Tags: Illustrator

Similar Questions

  • CS3 overlap of filling in an object cancels the fill color, how to fix this?

    I have an object closed, filled with black that overlapps itself, this overlapp as we become white. How can I get rid of this "white" area in the overlap?

    I'm competent enough in Illustrator CS3, but cannot understand this.

    forum-sample.gif

    Yes like Doug says you have the same fill rule the odd value and makes that happen if you change this return must be completed if you have applied a pathfinder command to art.

    Once you have changed the zero fill rule no winding you can if you want to apply the command unit in the pathfinder, which will give you a nice clean path compound with which you can work.

  • How to apply the transition to the fill color in the script? Call setValueAtTime? It does not work.

    Hello world!

    Can't stand not to code (setValueAtTime) following the transition from the fill color, but this feature is supported by After Effects CS5.5 UI. So please can you give a hint on how to implement the transition from the fill color in the script?

    ...

    Layer1 = app.project.item var (1).layers.addText ("Example Text");

    animator1 var is layer1. Text.Animators.addProperty ("ADBE Text Animator");

    var selector1 is animator1. Selectors.addProperty ("ADBE Text Selector");

    animator1 = animator1. Properties;

    animator1. AddProperty ("ADBE Text Fill Color").setValueAtTime(0,[0xff,0xe0,0x0,1]);

    animator1. FillColor.setValueAtTime(1,[0xFF,0x00,0xe0,1]);

    animator1. FillColor.setValueAtTime(2,[0x00,0xe0,0xFF,1]);

    animator1. FillColor.setValueAtTime(3,[0xFF,0xFF,0xFF,1]);

    animator1. AddProperty ("ADBE Text Rotation X") .setValue (ratationX);

    animator1. AddProperty ("ADBE Text Rotation Y") .setValue (rotationY);

    animator1. AddProperty ("ADBE Text Rotation") .setValue (rotation);

    animator1. AddProperty ("ADBE text scale 3D") .setValue ([100,300,100]);

    animator1. AddProperty ("ADBE Text Position 3D") .setValueAtTime (0, [-500, -300, -300]);

    animator1.position.setValueAtTime(5,[0,0,0]);

    selector1. Start.SetValue (0);

    selector1.end.SetValue (100);

    selector1.offset.setValueAtTime (0, -100);

    selector1.offset.setValueAtTime (3,100).

    selector1. Advanced.Shape.SetValue (2);

    selector1. Advanced.easeLow.SetValue (100);

    ...

    Thanks in advance!

    Your layers of color must be between 0 and 1, like this:

    animator1. FillColor.setValueAtTime (1, [1.0,.878, 1]);

    animator1. FillColor.setValueAtTime (2, [0,.878, 1, 1]);

    animator1. FillColor.setValueAtTime(3,[1,1,1,1]);

    Dan

  • JavaScript to perform the Action on the ground form - change the fill color according to requirement

    Hello world

    I apologize if this question has been asked already - but I was looking for the last hours of the couple and not finding what I need. I have a PDF form (created from an excel file) and need to change the fill color of a field drop-down list box to, based on the selection made by the user of this form field.

    Details - I have several questions on the application form. I have install a form field list box for each question so that the user can select the following options:

    Yes

    NO.

    Not sure

    I see in the Properties menu of the form field that I can perform an action when their "clicks of the mouse to the top" as the trigger (option run JavaScript); but I do not know what script to enter to do. This is where I need help

    So I need the script when the user selects one of the listed options, the fill color will change depending on the selected answer:

    'YES' changes fill with green color

    'NONE' red fill color change

    Yellow fill color of changes 'UNCERTAIN '.

    Please let me know if you need more details or a better explanation of what I need. Thank you for anyone who can help!

    PS - I'm a complete amateur in any type of JavaScript or codes, so I may need some explanation or if this is not possible.

    Do not use the mouse event to the top, but rather, you can use the custom following validation script:

    Custom script to validate combobox

    (function () {}

    Switch (event.value) {}

    case study "Yes":

    event.target.fillColor = color.green;

    break;

    case "No":

    event.target.fillColor = color.red;

    break;

    case 'uncertain ':

    event.target.fillColor = color.yellow;

    break;

    by default:

    event.target.fillColor = color.white;

    break;

    }

    })();

  • Remove the fill color of the field box on the deselection.

    When a user selects a check box, the field is colored yellow. Unfortunately, when the user disables the check box, the color remains.  I know that I need a statement to remove the color from the deselection, if/else, but can't quite get the right script. The checkbox named LEPID is my pig of India and he still has the nonfuctioning script that I worked with. Can someone tell me how to remove the fill color when the box is unchecked?  Thank you!

    Hi again,

    You had a few errors in the script:

    (1) in condition you should you use == instead =.

    (2) if (condition) but not if {condition}

    It's working script:

    If (this.rawValue == '1') {}

    this.fillColor

    = "244,254,114";

    }

    else {}

    this.fillColor

    = "255,25,128";

    }

    See also attach.

    BR,

    Paul Butenko

  • Symbols - how to change the fill color to a mouse event?

    I'm trying to convert HTML Flash animations.

    I have some problems with the symbols of the Edge. As a test, if I create a new symbol of circle I draw and call that the new 'Test' symbol, I then try to change the fill color in a scoring event.

    I tried this:

    Enter the code to be run when the mouse points to the object

    SYM. $("Test") .css ("background-color", "red");

    That, in fact, change the "background color", but NOT the fill color of my symbol. See the example below.hover.png

    So then how should I address the symbol 'Test' if I want to change the FILL color is an event like the hover?

    TIA!

    Use:

    sym.getSymbol("Test").$("Ellipse").css ("background-color", "red");

    where "Ellipse" is the element of circle inside the symbol

    HTH,

    Vivekuma

  • How to select several objects on the layers panel in Illustrator CC

    I have a work of guge and I need to select a small group (about 10-100) of objects from 4000 bunk and then group objects ' em/split-to-layers for ease of use (this is an infographic of the human body for medical institute)

    There IS NO way by selecting in the Web because they are overlapping and sometimes not visible at all.

    in CS5 there was a function to select several objects to the icon selection Alt + click - move on the right in the Layers panel.

    Now the mode duplication towers - on when I try to run it.

    Then.

    Ho I select several object without having to click through thousands of them? (I need to drag-select)

    IM totally frustrated.

    As long there is no deliberately locked object, you can do the following:

    Drag on the lock column in the layer panel

    Object > unlock all (there is a shortcut for this)

    -> unlocked objects are selected

  • Why can I not select an object from its Center?  Direct Selecttool will choose only encompassing.

    Why can I not select an object from its Center?  Direct Selecttool will choose only encompassing.

    You may have turned on "Selection of object by the path only" in 'selection Options.

  • How to get the fill color of a shape or solid color fill layers?

    Hi all

    I'm trying to get the values of the fill color of a shape or solid color fill layers.

    I get the nature of the layer active i.e. SOLIDFILL, but there is no color as a property to get the color of the shape or solid color fill layers.

    Y there is it possible or a script to do this?

    Please help me on this.

    Thank you
    AI

    I didn't bother to check the type of the active layer, but if a solid color layer is selected it should help.

    // based on code by michael l hale;
    var ref = new ActionReference();
    ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
    var layerDesc = executeActionGet(ref);
    var adjList = layerDesc.getList(stringIDToTypeID('adjustment'));
    var theColors = adjList.getObjectValue(0).getObjectValue(stringIDToTypeID('color'));
    var str = '';
    for(var i=0;i		   
  • change the fill color of the image

    I should produce small text boxes containing the reverse text (white letters on black boxes). How and where should I go to black color of picture fill?

    Select the image, and then to the swatches Panel, click the fill color icon in the upper left corner (the same icon is in the Toolbox and color Panel), then choose your fill color.

  • "selection of object by the path only" in Indesign?

    Hi, I have just changed to cs4 to 5.5 and can't seem to select an object, if it is another, even if the top element of a 'none' was complete. I know that I can hold cmd and select "via" objects but in cs4, I didn't need to do it as long as the top item had no fill. This preference can be enabled/disabled through the "selection of object by the path only" checkbox in illustrator, but I can't seem to find it in Indesign. Maybe I'm lazy who want to simply do not press the cmd button but it's just annoying the hell out of me for any clarification would be much appreciated.

    Ant.

    Hey Ant,.

    You use the 'Frame' Rectangle tool or the tool 'Rectangle '? I find that I selected the 'Frame' Rectangle tool, it will always be the selected object, even if it has no fill; using the "Marquee" tool, if it has no fill, you can select the objects below it without going through CMD-click.

    Hope that helps,

    See you soon!

    Mikey

  • CS3 AS2 - changing the fill color

    Hello!

    I don't know how to change the color of the movieclip but I can't find a way to change just the fill color of the movieclip and no hits... is this possible?

    I guess that there are several ways to do so.  I could change just the filling of an MC is to select only the filling and convert it to a symbol.  After giving your new symbol to an instance name, you can reference it in AS2 to change its color. I hope this helps.

  • dynamic changes of the fill color box

    I would like to know how to dynamically change the fill color of a checkbox control.  When I use the following code, I change the color of the object in its entirety (including the text).  I want to just change the color of the box.

    this.fillColor = "255,255,0;

    Any idea?

    Thank you
    Emily

    Try

    xfa.resolveNode("form1.page1.cb.ui.#checkButton.border.fill.color").value = "255,255,0;

    where the checkbox object is "form1.page1.cb".

    Steve

  • When I type or paste a URL into the address bar or select a url from the address bar dropdow, the "enter" button does nothing. I have to press the green arrow to load the url?

    Each time it manually to enter a url, past a url, or select a url from the address bar, the system requires that I click on the green arrow to go to the url. The entrance to key doe nothing. Am I the only one having this problem?

    This problem may be caused by an extension (possibly AVG Safe Search) which does not work properly.

    Start Firefox in Firefox to solve the issues in Safe Mode to check if one of the extensions of the origin of the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > appearance/themes).

    If this does not work in mode without failure, then disable all extensions and then try to find out who is the cause by allowing both the problem reappears.

    • Choose "Disable all add-ons" on issues to troubleshoot Firefox in Safe Mode to set window to disable all extensions.
    • Close and restart Firefox after each change through "file > exit ' (Mac: ' Firefox > leave";) Linux: "file > exit ')

    In Firefox 4, you can use one of them to start in the questions to troubleshoot Firefox in Safe Mode:

    • Help > restart with disabled modules
    • Hold down the SHIFT key while double-clicking the shortcut from the desktop Firefox (Windows)
  • Change the fill color based on the range of values

    Creating a form to inspect the parts. Work on the setting up of a text field to change the fill color based on the number or the data entered. For example: If is between 0-20 fill color is red, between 20-24 fill color is green, more filling 24 is still red, and if no data is entered in the fill color is white. The script below works for me but keeps the red field when data is deleted (empty) field. Not sure if im approaching this correctly so I should be looking at differently? I have different ranges for many fields and im trying to keep the script right to the front as possible. Thanks in advance for any help.

    If (event.value > '24')

    event.target.fillColor = color.red;

    Else if (event.value < '20')

    event.target.fillColor = color.red;

    else event.target.fillColor = color.green;

    You do not have... Change this line:

    Else if (event.value > '24')

    To do this:

    Else if (event.value > 24)

    And even with "20".

Maybe you are looking for