Referring to an object, according to its characteristics (fill color)

Hello scripters

(This could be very basic, so if I did not yet find it anyware).

Is there a way to refer to an object based on its characteristics, such as fill color and then manipulate it (delete, move)?

I would be grateful for any help.

Here is an example:

Main();

function Main() {
    var doc = app.activeDocument;
    var rectangles = doc.rectangles;
    var swatch = doc.swatches.item("C=15 M=100 Y=100 K=0");

    for (var i = rectangles.length-1; i >= 0; i--) {
        if (rectangles[i].fillColor == swatch) rectangles[i].remove();
    }
}

Tags: InDesign

Similar Questions

  • variable that refers to an object

    In general, I am trying to use a variable to refer to an object.  On the platform of Flex 3, I have about 100 radio button groups.  I want to loop through data that has been returned to starting from the database and the radio buttons toggle based on data.

    public void...

    var counter: Number = 1;

    aString: String var = "";

    var qString:String = "";

    loop...

    sString = ("A" + counter);

    qString = ("q" + counter);

    If (.aString returnArray [0] == '0') {}

    qString.selectedValue = "accept";

    }

    counter ++;

    My radiobutton objects are named q1, q2, q3, etc..  String qString.selectedValue = "accept"; does not evaluate as an object name.  I tried. valueOf() and always generate errors.  I know that I am doing something stupid.  Can someone enlighten me please?

    Can't tell exactly what you itirating from your code, but I would look something like this

    var count: int = 1;

    var totalNumber:int =?

    for (counter = 1; counter)< totalnumber;="" counter="">

    {

    aString = "a" + counter;

    qString = 'q' + counter;

    This ['qString'] .selected = (.aString [counter] returnArray == "0");

    }

    the interesting part is this syntax ['qString']... which allows to refer to an object by passing its name.

    as your current shape is a table containing all the your user interface.

  • New iPhone IS does not work with MAC Mini 10.6.8. Apple support says upgrade your iTunes. Its the wrong color icon. WHAT? iTunes is the last 11.4 for my mac. All my music is on my Mac. Help!

    New iPhone IS does not work with MAC Mini 10.6.8. Apple support says upgrade your iTunes. Its the wrong color icon. WHAT? iTunes is the last 11.4 for my mac. All my music is on my Mac. Help!

    That is right. The requires iTunes 12.3.3 and in order to get it, you will need to update OS X to El Capitan. That's how Apple has created for better or worse, I'm sorry.

  • I think it would be helpful if when you open the drop-down list for a 3D object keyframe controls have the same color as the 3D arrows in the project window.

    3D colors.jpgI think it would be helpful if when you open the drop-down list for a 3D object keyframe controls have the same color as the 3D arrows in the project window.

    You can suggest that here:

    Feature request/Bug Report Form

  • 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

  • How select the open path objects do not understand no filled object?

    I use CS6.

    I want to select open path objects, but does not include any filled object.

    This means that if these objects with open path and filled with any color or gradient, I would like to select.

    Now, I can select objects with open path.

    var doc = app.activeDocument;

    doc. Selection = null;

    numClosed = 0;

    for (var i = 0; i < doc.pathItems.length; i ++)

    {

    If (! doc.pathItems [i] .closed)

    {

    doc.pathItems [i] .selected = true;

    numClosed ++;

    }

    }

    Alert ("open paths of access.." + numClosed);

    But how can we not take into account no. filled with forms?

    Does anyone know?

    Thank you.

    Hi @jeen,

    If you want to select only paths open with any color fill, you can replace this line:

    If (! doc.pathItems [i] .closed)

    with this:

    If (! doc.pathItems [i] .closed & doc.pathItems [i] .filled == true)

    Have fun

  • How to customize display in ItemRenderer according to its index in the dataProvider in Flex 4.1?

    I went through a lot of forums to get this answer, without success. I have to admit, I'm quite 'green' with Flex and my mother tongue is the French, so if I am not clear, I apologize.

    I would like to use the same ItemRenderer for all items in a list, but only for the first (index = 0) item in the dataProvider I have 1 child of the non-visible ItemRenderer.

    Currently, I have something like that in the ItemRenderer:

    override public function the value of {} data(value:Object):void

    var itemList:List = owner as list;

    var listProvider:ArrayCollection = itemList.dataProvider as ArrayCollection collection;

    var isFirstItem:Boolean = false;

    If (listProvider.GetItemIndex (Data) == 0) {}

    isFirstItem = true;

    }

    }

    And then if isFirstItem = true, I hide the child I wanted to hide for the first item in the data provider.

    The problem is that listProvider.getItemIndex (data) == 0 seems to be true not only to article 1 in the dataProvider. The child I want to hide becomes too hidden on some (not all).

    It seems to be linked to the fact that the list has a scroller and so not all items in the list are shown at the same time.

    Does anyone have an idea how I could do this? Or just some advice, I'm really out of the solutions here.

    Thank you!

    do you explicitly say if the first element then hide the child, see the thing of the child

    itemrenderers are reused, so if you do not have the else clause so when you scroll the rendering engine is displayed in its original state

    (I guess)

  • Extraction of data in the object according to the type of table

    Hi reading,.

    Could you please help me to resolve the following error?

    =================================
    SQL > create or replace the emp_obj as an object Type (emp_no, e_name varchar2 (100));
    2.

    Creative type

    SQL > create or replace type emp_tab is table of the emp_obj;
    2.

    Creative type

    SQL >
    SQL > declare
    2
    3 l_emp emp_tab: = emp_tab();
    4
    5. start
    6 select empno, ename
    in 7 bulk collect into l_emp
    8 of the emp
    9 where deptno = 20;
    10
    11 because I in l_emp.first... l_emp loop. Last
    12 dbms_output.put_line (l_emp (i) .emp_no);
    13 dbms_output.put_line (l_emp (i) .e_name);
    14 end of loop;
    15 end;
    16.

    declare

    l_emp emp_tab: = emp_tab();

    Start
    Select empno, ename
    bulk collect into l_emp
    WCP
    where deptno = 20;

    for me in l_emp.first... loop of l_emp. Last
    dbms_output.put_line (l_emp (i) .emp_no);
    dbms_output.put_line (l_emp (i) .e_name);
    end loop;
    end;

    ORA-06550: line 9, column 3:
    PL/SQL: ORA-00947: not enough values
    ORA-06550: line 7, column 3:
    PL/SQL: SQL statement ignored

    SQL >

    ===========================

    Thanks in advance!

    The thread title half-answers the question: you get objects, not the columns:

    select emp_obj(empno, ename)
    bulk collect into l_emp
    ...
    
  • How specify style character to anchor markers of objects according to the formats of objects.

    I have a long document contains many blocks of text anchored with custom positions and want to remove by applying character styles to their scorers.

    Create a new character style to apply it. Change the character style name in this code to you, then run it.

    main ();
    function main (){
        app.findGrepPreferences = NothingEnum.NOTHING;
        app.findGrepPreferences.findWhat = "~a";
        var objectsArray = app.activeDocument.findGrep();
        for (var c = 0; c < objectsArray.length; c++) {
            if (objectsArray[c].textFrames.length > 0) //The anchored object is a text frame
            {
                var targetTextFrame = objectsArray[c].textFrames.item(0);
                var textFramePosition = targetTextFrame.anchoredObjectSettings.anchoredPosition;
                if (textFramePosition == AnchorPosition.ANCHORED) // the object have custom position
                {
                    //Create a new charater style and change the character style name to yours.
                    objectsArray[c].appliedCharacterStyle = app.activeDocument.characterStyles.itemByName("Delete");
                }
            }
        }
    }
    

    Then do a GREP search for this style of character and if you want to remove them while button any changes.

  • How to divide an object and preserve its gradient?

    Hello!

    I tried to do something that seems simple enough, but unfortunately I failed. I tried to find advice on the forums, but did not as well. So hopefully someone here can point me in the right direction.

    I have an object with a gradient (in my case a simple triangle - see below) now I want to divide it into 4 parts without losing the way in which the object appears.

    ex1.jpg

    No matter how I try, I always end up with 4 parts which each have degraded originally applied to them (see below).

    ex2.jpg

    I would like to get something that looks like this:

    ex3.jpg

    I hope that I can do this with Illustrator and someone knows how. Thank you very much!

    Simply select the 4 pieces and use the gradient tool to drag the gradient across all 4 pieces.

  • referring to an object in a repeating subform

    Trying to get the value of a text field in a repeating subform (lets call it the subform "Identify") of my form to be set to the value of "TextField18" in the corresponding instance of Subform subform 'groups '.

    In more detail:

    In the form, I ask the question - groups how do you have? The number of this answer is the number of instances of the subform 'Groups' that I have. Within this subform is a text field ("text Field18") where the user will enter the name of the group.

    Later, in a completely different section of the same shape, I have a subform called "identify." I understand how to set the number of instances of "Identify" to match the number of instances of 'groups '. I want to do is have a field 'Identify' display the name of each group (as he entered "TextField18" in the "Groups" subform) - one per instance of the subform.  So if the groups were in Orange, red and purple entered instances of 1-3 respectively on the subform "Groups". I want the field 1 of the "Itentify" subform to autopopulate with Orange and the field in case 2 of autopopulate pending with red and so on.

    Is this possible?  All advice is appreciated!


    Hello

    Your repeated subforms, groups and identify, will have a property index to identify their appearance.  Thus, in the case of calculation of the object textfield to identify using JavaScript place the following code;

    xfa.resolveNode ("groups [" + Identify.index +"]. TextField18") .rawValue;

    This will return the corresponding value in the subforms of groups.  Note You may need to adjust the SOM expression if the groups and identify them are not at the same level.

    Bruce

  • referring to an object outside of the function in a listener.

    Well, I'm still new to AS3.  Can someone tell me what's wrong with this code?  I have four buttons named button1, button2, button3 and button4.  I want the code to find the name of the button when the button is clicked.  It is just a multiple of what I do in my project.  The project itself is too complicated to implement and explain.  My problem that must be solved is what do I do for the button in the function?

    var c:int;

    var buttonName:String;

    for (c = 1; c < 5; c ++) {}

    buttonNum = "button" + c;

    This .addEventListener [buttonNum] (MouseEvent.MOUSE_DOWN, pressStepButton);

    function pressStepButton(event:MouseEvent) {}

    trace (this);

    }

    }

    When I say "trace (this)", the code doesn't know what 'this' is because I took this [buttonNum] out of the loop by the need to put it in a function.  How to call to the object that is the listener that called the function?

    Use event.currentTarget (and you don't need to define the same function several times):

    var c:int;

    var buttonName:String;

    for (c = 1; c< 5;c++)="">

    buttonNum = "button" + c;

    This .addEventListener [buttonNum] (MouseEvent.MOUSE_DOWN, pressStepButton);

    }

    function pressStepButton(event:MouseEvent) {          trace(event.currentTarget,event.currentTarget.name);     }
    
  • Refers to an object with String (ID)?

    I am trying to build a container/Manager glow in order to enable and disable the appropriate component. Indeed, when a specific component as a result of a click, it will be shone. But if the user clicks on another specific component, the previous shone should unglow and a new will be shone.

    Now, to do this, I created a class with 2 items: objReference:String and glowActive:Boolean. I also created a collection ArrayCollection of all components that can meet the glow effect and put them inside like this:

    objReference = [object] USER.USER

    And each component get FALSE to glowActive at the opening of the ArrayCollection collection.

    I have a problem with the recognization of the ID of the object. When I tried to play the glow using the objReference, the system will show the following error message:

    TypeError: Error #1006: value is not a function.
    to mx.effects::EffectInstance/play() [E:\dev\3.0.x\frameworks\projects\framework\src\mx\effec ts\EffectInstance.as:584]
    to mx.effects.effectClasses::GlowInstance/play() [E:\dev\3.0.x\frameworks\projects\framework\ src\mx\effects\effectClasses\GlowInstance.as:194]
    to mx.effects::EffectInstance/startEffect() [E:\dev\3.0.x\frameworks\projects\framework\src\m x\effects\EffectInstance.as:569]
    to mx.effects::Effect/play() [E:\dev\3.0.x\frameworks\projects\framework\src\mx\effects\Effec t.as:930]
    at home / setCategoryGlowIn [C:\Documents and Settings\DJ FYB\My Documents\CharlesValcourt\includes\charlesvalcourt_logique.as:303])
    at home / clickCategoryBox [C:\Documents and Settings\DJ FYB\My Documents\CharlesValcourt\includes\charlesvalcourt_logique.as:282])

    I'm a little confused about how call an object by reference and stored the object Guide in another (in my case, in an ArrayCollection collection).

    Yay! I found how to do it!

    First of all, I finally make the property objReference in my GlowObjectReferencer class as an object in order to work.

    I need to have myHB as the object (which, as I understand it, will be a reference to the current object into the new Object class).

    var _objReference:GlowObjectReferencer = new GlowObjectReferencer (myHB, false);

    And when I run my functions to manage the glow FX (setAllCategoryGlowOut and setCategoryGlowIn), it is now working fine!

    I am so happy now! I knew it was possible, but in my mind, it was simply not logical to store an object in the class, but it seems that that's what I do! But just to make sure that: I go to the GlowObjectReferencer class as the first property only the reference to myHB? Not a copy of myHB; right?

    Again, thank Tracy because you force me to find a way to do it! ;-))

  • I recently installed Firefox 4.0, and during its characteristics description it says that my menu does not appear, but it will be groupted in a tab, but it seems like old ver 3.6, why? and if her look can be changed how?

    How to change to the new look of firefox (like chrome). Help, please. I love Firefox.

    A way to configure Firefox to customize the toolbars, which allows you to add, remove and rearrange items on toolbars as stated in this link - https://support.mozilla.com/kb/how-do-i-customize-toolbars

    Another common way of configuration of Firefox is using modules as shown here - https://support.mozilla.com/kb/Customizing+Firefox+with+add-ons

  • Question about apple tv and its characteristics?

    So here's the situation

    I have a data plan unlimited through Sprint and I bought an Apple TV so that I could use this data to stream Youtube and Netflix videos on my apple tv via the peer-to-peer connection. I got this feature to work with Apple TV connected to my houses wifi and turn on my bluetooth and Wi - Fi on my phone. The problem I have is that he still uses data on my home network and most of the people who would not be a problem but I have satellite internet and satellite internet has limitations of predefined data you cannot exceed. So my question is can I buy a wireless router for my apple tv and use that in the flow of my phone and which wireless router will not be connected to a modem? So, essentially, it would emit just a wireless signal that could be used, but would not have access to the internet via my ISP. Would this work or am I just screwed?

    For me the most logical thing would be to set up your phone as a hotspot and connect the Apple TV to this network.  I wouldn't connect to the WiFi at home.

    It seems by connecting the phone and the Apple TV to the home Wi-FI you are using Airplay.  How do you run the phone to get the data from your wireless connection when it is connected to your WiFi?  Seems that the phone would be the internet connection to the home network only?

    If you want to test your idea of ghost network without having to buy another wireless router, simply disconnect the existing internet by satellite of the wifi at home and see if it works without an internet connection.

Maybe you are looking for

  • New iMac keeps death beach ball?

    Hello I have an iMac (retina 5K, 27 inches, end of 2015) - brand new to replace my old faithful version 2007.  However, every day that I'll have to restart I get the beachball of death - everything freezes and stop force is not an option.  I also doe

  • WIFI problem with all new Satellite C660

    Hello I just bought a new Toshiba Satellite C660-108, I found it won t pick up and hold the wireless, I returned to the store and they replaced, but same thing happened. It works when I plug on-line.

  • HP pavilion dv6103nr, windows xp media center edition, recovery

    I get this error message "Windows is not start because the following file is missing or corrupt...". Please reinstall a copy of the above file' the file name changed after I tried a system restore and is currently \system32.hal.dll I tried several di

  • Madame ISABELLE KNIGHT

    Lottery Microsoft 2010: I received a message from microsoft that I won the lottery 2010... Please let me know if it's true I received a message from microsoft that I won the lottery 2013...       Please let me know if it's true... American Lottery po

  • Cannot start Windows after log-in initial screening... screen is blank

    Out of the Blue yesterday, I was unable to boot WIndows 7 and I've now exhausted everything that I can find to get help.  Here's what happens: turned on computer, screen load with "starting windows" and windows icon hits the screen.  The login page i