Get the name of object fillColor?

Hello!

I know how to get the fillcolor object.

myCurrentObject.fillColor

But how do I get a custom name for this color, if it exists in the nuances? If someone has worked with this, please lend a hand!

myCurrentObject.fillColor.name // Not works

You need all the objects with color - which exists in the sample, to provide for the individual layers and assign names - names of swatches?

If I understand correctly, then:

function comparingArrays ( a, b ) {
    var c = 0;
    if ( a.length !== b.length ) return false;
    for ( var i = 0; i < b.length; i++ ) if ( a[i] === b[i] ) c++;
    if ( c === b.length ) return true; else return false;
}
function parseValArr (a) {
    var b = []; for ( var i = 0; i < a.length; i++ ) { b.push( Math.round(a[i]) ); }
    return b;
}
function getColorValues ( color ) {
    if ( color === undefined ) return undefined;
        else if ( color.typename === 'CMYKColor' ) return [ color.cyan, color.magenta, color.yellow, color.black ];
        else if ( color.typename === 'RGBColor' ) return [ color.red, color.green, color.blue ];
        else if ( color.typename === 'LabColor' ) return [ color.l, color.a, color.b ];
        else if ( color.typename === 'SpotColor' ) return getColorValues( color.spot.color );
        else if ( color.typename === 'GrayColor' ) return [ color.gray ];
}
function getSwatchOfTheColor ( color ) {
    var s = activeDocument.swatches,
        i = s.length,
        arr = [];
    while ( i-- ) {
        if ( s[i].color.typename === color.typename ) {
            if ( comparingArrays( parseValArr( getColorValues(s[i].color) ) , parseValArr( getColorValues(color) ) ) ) {
                arr.push( s[i] );
            }
        }
    }
    return arr;
}
function setAttr ( obj, options ) {
    if ( options ) {
        for ( var i in options ) {
            for ( var j in obj ) {
                if ( i === j && !(options[i] instanceof Function) ) {
                    obj[j] = options[i];
                }
            }
        }
    }
    return obj;
}
function createLayer ( obj, options ) {
    var layer = activeDocument.layers.add();
    obj.moveToBeginning( layer );
    setAttr( layer, options );
}
function process ( objects ) {
    for ( var i = 0; i < objects.length; i++ ) {
        if ( objects[i].typename === 'GroupItem' ) {
            process( objects[i].pageItems );
        }
            else {
                var swatchColor = getSwatchOfTheColor( objects[i].fillColor )[0];
                if ( swatchColor ) createLayer( objects[i], { name: swatchColor.name } );
            }
    }
}
process( selection );

Tags: Illustrator

Similar Questions

  • Get the name and the data type into an object?

    Hello

    I would like to know if there is a way to get the names and the types of data encapsulated in an object of labview?

    For example, let's say I make a simple object, called myObject to be commonplace, with private data: myObjectName (string), myObjectValue (int 32) (etc.)

    So, how to build a method to return the type of the data of myObjectValue, or infact back the names and types of all data in the object field, which could be a lot?

    Thank you

    Paul.


  • Get the name of the current stage of MainSequence in parallel sequence

    Hello

    I starts a sequence in parallel of the MainSequence by "use new run." This parallel sequence is constantly in querying CPU performance data for my USE and records 'on the fly' an Excel file while the MainSequence turns the test scenario.

    To get a clear reference of the performance of the CPU DUT to test steps, I need to somehow get the name of the step of the test step currently performed in the MainSequence for saving it and the CPU performance data.

    Is it possible to identify the current stage of the main sequence in the parallel sequence (for example, property)?

    Thanks in advance,

    MRet

    Rette01 wrote:

    Hi Doug,.

    Finally, we have updated to TestStand 2013 and try to use your example.

    We have some problems to get the referral of wire, which is replaced by "threadToMonitor" in the expression you have posted, as far as I understand.

    The thread to monitor is the MainSequence. So, how can I get a reference to the MainSequence?

    Kind regards

    Rette01

    Pass RunState.Thread as a parameter to the call of the sequence. The parameter must be specified as an object reference variable.

    -Doug

  • How do I get the name of a duplicated or created control and add a reminder

    Hi all

    According to the number of entry points I need, I duplicate a digital or an input string to the DuplicateCtrl function. My question is, how do I get the name and id of the control that has been created, and how can I assign a callback to it? Alternatively, it would be better to create a fresh ctrl instead of duplicate?

    Thanks in advance!

    Hi TurboMetrologist,

    Why are you trying to get the name of constant control? Remember that you cannot use this name to address control; control names are in fact simply the macros in the file associated with the UIR, include in other words, the preprocessed compiler code and everywhere where the names of PANEL_CONTROL replaces the digital value as parameters to functions (and therefore 'control' parameter is an int value and not a char *)

    That's why NewCtrl () or DuplicateCtrl () functions return a control ID: this is the handle to the new object, the only way to handle it. You will need to store this handle in a nonvolatile memory so that you can access durng life program.

    In addition, there are other ways to assign a meaning to a control to pass on the name of constant control. For example, you can use the callbackData parameter to differentiate the different copies of a control.

    Let me explain with an example. You said that you need several entries (dynamically created that you don't know in advance how many of them use); a solution could be:

    • Design a master copy of a control in the IUR Editor, where it is easy to customize; also assign a callback function, if it must be common to all copies of the control
    • Assign a value to this control callbackData, programmatically for example SetCtrlAttribute (...,..., ATTR_CALLBACK_DATA, (void *) 1);
    • Duplicate the control, and then assign a different callbackData
      for (i = 2; I have< 5;="" i++)="">
      handle = DuplicateCtrl (...);
      SetCtrlAttribute (..., handle, ATTR_CALLBACK_DATA, (void *) I);
      }

    By operating this way, whenever the reminder of control is triggered by any control, it will receive the callbackData assigned, and you will be able to differentiate your code with a simple switch:

    switch (callbackData (int)) {}

    case 1: / / the master controls

    break;

    case 2: / / first dual control

    break;

    }

  • interoperability c# get the name of the step

    I'm trying to use a code c# module in order to be able to read the name of the step of the call. However, my code only all returns 'Step' as the name of the object (no matter what the step is actually called in the sequence). Note that I also tried to do the same thing to get the name of the calling sequence - and it always returns 'Sequence '. Where I'm going wrong? Here's the code: (see attachment for full source and example TestStand sequence in the "Debug" folder.

    using System;
    using System.Collections.Generic;
    using System.Text;
    using NationalInstruments.TestStand.Interop.API;
    using System.Windows.Forms;

    namespace Test
    {
    public class TestClass
    {
    public void TestMethod (SequenceContext thisContext)
    {
    PropertyObject pObj = thisContext.AsPropertyObject ();
    PropertyObject stepObj;
    stepObj = pObj.Evaluate ('Step');
    MessageBox.Show (stepObj.Name);
    }
    }
    }

    As a bit of background, I'm trying to retrieve the name of the step of the call and the name of sequence all call them all the way to the top of the stack to the root. This same method works using the steps of the Expression, but I would like to hide the mess in a single code module. Any ideas would be appreciated!

    Thank you

    Phil

    Hi Ray,

    Thanks for the tips. Unfortunately, I think I did my a little too simplistic example! Your solution is perfect for the case of the name of the step, unfortunately, this won't work for what I'm trying to do. I write a journal of custom result which is called from the ProcessModelPostResultListEntry callback and check if 'The RecordResult' is enabled on all stages of SequenceCall in the stack and if every sequence in the stack has the option "RecordResults" is enabled. (Essentially, result record should be enabled at all levels so that the result to be connected). You may think that the recall of ProcessModelPostResultListEntry would be called only if this condition is met - unfortunately, it is only affected by the combination more nested "RecordResult" step and the properties of "RecordResults" of the sequence. Therefore, frustrating, I need to check all the way to the top of the stack to the ProcessModel. The reson why it is more complex, it is that step and sequence property further to the top of the battery are accessible by using the Evaluate() method, as opposed to the lowest level in the stack that can be accessed via thisContext.Step and thisContext.Sequence.

    In any case, I worked it out in the end: in TestStand Expressions allow you to take a number of shortcuts to APIs that are not available when you use the API in a different language - so why I was able to use phrases such as:

    Locals.SequenceRef = evaluate ("RunState.Caller.RunState.Caller.Sequence"),

    Locals.SequenceName = SequenceRef.Name

    Locals.SequenceRecResult = SequenceRef.RecordResults

    whereas the similar c# code worked as expected (note that the string of RunState.Caller above is actually built dynamically depending on the depth of the call stack).

    Be more explicit in c# works correctly even if:

    seqObj = pObj.Evaluate ("RunState.Caller.RunState.Caller.Sequence");
    SequenceName = seqObj.Evaluate ("name"). GetValString ("", 0);

    SequenceReqResults = seqObj.Evaluate ("RecordResults"). GetValBoolean ("", 0);

    Although writing this response, I just found the following property:

    SequenceContext.CallerDiscardsResults

    ' Returns if any order in the call stack tells TestStand to disable the results or if any step caller in the call stack instructed TestStand do not save results.

    Typical! I think that this may be an easier to use way!

    Thanks anyway,

    Phil

  • Can ODI - I get the name of the file in a variable?

    Hello, I am trying to get the name of the folder (or subfolder) dynamically over the package that is currently running. I tried various API (from the Toolbox) calls including < % = odiRef.getSession("SESS_NAME") % >, but this isn't quite what I need.  I'm real new to ODI...

    I'm under ODI 11.1.1.6

    Thanks in advance.

    CL

    Yes, I think that this decision if more flexible. I use this way.

    . or you could hold information about the records in the table or XML file or a properties file and store it in the variable... It depends on your tasks and objectives

  • How can I get the name of the procedure

    Hello

    With the help of our application, we update a table (P_Balance) in the statement of account and date thanks to certain procedures.

    in some column of status situation alone expects to obtain the correct value, but the date column with the value NULL.

    Now, we have decided to follow this through which procedure to get this updated value null date column.

    To do this, I decided to write a trigger for the table 'P_BALANCE' by what procedure, this update going on.

    How can I get the name of the procedure.

    Hello

    You can write the call stack in a log whenever the value of the column is null. See

    DBMS_UTILITY. FORMAT_CALL_STACK

    This will give you the name of the object and the line numbers of the update program.

    Concerning

    Marcus

  • How to get the name of model of the physical network adapter

    I can see the template information for my network via vcenter card, but need help with registration this info for powercli.

    for example, that I'm looking for my request to have this output:
    "Broadcom Corporation NC370i Multifunction Gigabit Server adapt."

    Hello, jstroehmann-

    How about something like:

    ## get the .Net View objects for all of the host systemsGet-View -ViewType HostSystem -Property Name,Config.Network.Pnic,Hardware.PciDevice | %{    ## store pipeline variable for later use    $viewHost = $_    ## for each PhysicalNic on the host, output a bit of info    $viewHost.Config.Network.Pnic | Select @{n="HostName"; e={$viewHost.Name}},Device,MAC,@{n="NicDisplayName"; e={$oPNic = $_; ($viewHost.Hardware.PciDevice | ?{$_.Id -eq $oPNic.Pci}).DeviceName}}} | ft -auto
    

    He catches the .net visualize the object of all the HostSystems, and then displays some info like hostname, VMNic name, its MAC address, then the full name you mentioned.  You could, of course, something with the release other than send it to Format-Table.  How does do for you?

  • How to get the name of the particular index table option.

    Hello

    Can any body tell how to get the name of the item to a particular array.i have a table within array.i must compare the name of Francesca in particular key.here is the table.

    myArray= Array (@43b1e09)
    [0] = object (@42b33f9)
    Testing_1 = Array (@4428821)
    [0] = object (@43adc19)
    choice_id = '0 '.
    delete = "N".
    DownloadURL = "xyz".
    selected = 'Y '.
    translation = "2_486."
    length = 1
    length = "N".
    Editable = 'Y '.
    field_id = '388 '.
    LanguageLink = 'Y '.
    linked_definition_id = null
    multiple values = "N".
    name = "Photo".
    otheroption = "N".
    photovitlink = object (@43ad0d9)
    required = "N".
    step = '1 '.
    translation = "Photo".
    visible = 'Y '.
    [1] = object (@43ad5d9)
    [2] = object (@4490089)

    Here is the structure of the table I get server side.i give table name of result as table myArray.This have several child as an object of object.each having .i table (Testing_1 in the first case) must get the name of this Testing_1 table and compare with my sort key that I perform an operation. But I am unable to get the name of this Testing_1 array(Since_it_is_dynamic_so_this_name_changes_some_times).can a body guide me how to get the name of this table.



    Thanks and greetings

    Vineet Sharma

    Hi Vineet Osho,

    You can browse your object using the loop and you can get the name of the table... as below...

    for each (var obj:Object in myArray)
    {
    for (var str:String in obj)
    {
    If (obj [str] is array)
    {
    var arrayName:String = str;
    }
    }
    }

    Thank you

    Jean Claude

  • Get the name of the variable

    Hello

    May be a simple question, but I can't understand how in fact.

    When I do this

    //--------------------

    var obj:Object = new Object();
    obj.test = 'My Test';

    for (var i: * in obj)
    trace (I + ":" + obj [i]);

    //--------------------

    The output is-> test: test my

    My problem is when I put an object inside the object

    //--------------------

    var obj:Object = new Object();
    obj.test = new Object()

    obj.test.secondTest = 'My Test';

    for (var i: * in obj)
    trace (I + ":" + obj [i]);

    //--------------------

    The output is-> test: [object Object]

    So no idea how to get the name of the variable instead of [object Object], like the first release, but with the second code. I have an object inside an object.

    Thank you

    The following approach will dig its way.  I've added other variables to the main object just for the sake of the demo...

    var obj:Object = new Object();
    obj.Test1 = "test string";

    obj.test = new Object();
    obj.test.secondTest = 'My Test';

    obj.test2 = new Object();
    obj.test2.secondTest2 = new Object();
    obj.test2.secondTest2.val = "test deeper."

    function traceObjectVars(obj_arg:Object):void {}
    for {(var i: * dans obj_arg)}
    If (typeof (obj_arg [i]) is' objects ' ') {}
    traceObjectVars (obj_arg [i]);
    } else {}
    trace (I + ":" + obj_arg [i]);
    }
    }
    }

    traceObjectVars (obj);

  • Getting the name of the variable?

    Hi, is it possible to get the name of the defined variable?

    for example

    var description:String = "Some description";
    var variableName = getVariableName(description);
    trace(variableName); // output = "description"
    
    

    Thank you

    You can retrieve the xmllist of the variables (string or otherwise), of any object (for example, the current timeline) using the following function.  each item in the list has a property of type with the name property:

    function variableF(o:Object):XMLList {}

    .variable describeType (o) return;

    }

  • How to get the name of the server instance

    Hi all!!

    First of all, sorry if this is not the place to leave this question, but I didn't know where to post.

    I have a weblogic 9.2 MP3 installed in a x 64 Redhat Linux. It is clustered in 2 cases.
    An application is deployed in both cases, each request between two instances of balancing.

    Of course, a request is responsed by only one instance, and I would like to know how to get the name of the instance that processes a request of some.

    I read that I can send using recorded weblogic mbeans in this way:
    InitialContext ctx = new InitialContext();
    MBeanServer mbean = (MBeanServer)ctx.lookup("java:comp/env/jmx/runtime");
    Then
    ObjectName rs = new ObjectName("com.bea:Name=RuntimeService,Type=weblogic.management.mbeanservers.runtime.RuntimeServiceMBean");
    Set beans = mbean.queryNames(rs, null);
    And finally I iterate over the beans, but I'm not able to retrieve the name of the instance. I suppose that the object name is not appropriate.

    However, I am able to get the name of the server and the two names of instances per a JMX connection to service:jmx:t3://localhost:7001/jndi/weblogic.management.mbeanservers.domainruntime, but this isn't what I want because I need to know what is the instance that is a certain demand.

    Anyone know how I can do?

    Thank you very much and sorry for the English xD

    Published by: mamntc02 on 01/05/2010 05:10

    That should do it...

    private String getServerName() throws Exception {}
    try {}
    Context ctx = new world;
    MBeanServer mbeanServer = (MBeanServer)ctx.lookup("java:comp/env/jmx/runtime");

    String runtimeServiceName = "com.bea:Name = RuntimeService, Type = weblogic.management.mbeanservers.runtime.RuntimeServiceMBean;

    Create ObjectName for the runtime
    RuntimeService ObjectName = new ObjectName (runtimeServiceName);

    Get the object for the ObjectName ServerRuntimeMBean name
    ObjectName serverRuntime = mbeanServer.getAttribute (runtimeService, "ServerRuntime") (ObjectName);

    Get the name of the server
    String serverName = (String) mbeanServer.getAttribute (serverRuntime, "Name");
    If (serverName == null) return "";
    otherwise return serverName;
    }
    catch (Exception e) {}
    throw e;
    }
    }

  • How can I get the name of rulefiles in application with the help of custom java code.

    Hello.
    I want to get the names of rulefiles of analytical service with the help of java api.
    How can I get the name of rulefiles. What api should I use for this problem?

    Hello

    IEssCube.getOlapFileObjects () api allows you to retrieve files of rules.
    Insert this code snipid in your code, it will list all the rules files.

    IEssCube cube = olapSvr.getApplication("Sample").getCube ("Basic");
    ITR IEssIterator = cube.getOlapFileObjects (IEssOlapFileObject.TYPE_RULES);
    RFS [] IEssBaseObject = itr.getAll ();
    System.out.println ("rule file count:" + rfs.length);
    for (int i = 0; i)< rfs.length;="" i++)="">
    System.out.println ("RuleFile" + i + ":" + ((EssOlapFileObject)rfs). getName() ' ");
    }

    You can also list the data files and other objects in file by changing the IEssOlapFileObject.TYPE in getOlapFileObjects()

    Concerning
    Rajeev Singh

  • HP pavilion dv6: how to get the name of the product

    Cannot get the name of the model in order to download the proper drivers .will help as soon as possible. THX

    Hello

    You can usually get this by holding down the fn key and pressing ESC, or see here for a guide to the location of such information.

    Kind regards

    DP - K

  • Get the name of the network license server automatically?

    Is it possible, perhaps by means of Windows Script, to get the name of a computer is currently using the license server?

    Hi Rose Dalban,.

    You can know which servers a computer turns to the registry HKEY_LOCAL_MACHINE\SOFTWARE\FLEXlm Manager\NILM_LICENSE_FILE license key

Maybe you are looking for

  • Webcam locked by another application on Satellite T130-16w

    Hello Whenever I tried to use an application requiring the webcam (Skype, for example), a message saying that the webcam is in use by another application appeared. I tied reboot nothing helps. I so, following the advice of the interent, uninstalled t

  • meter returns garbage values

    I use cDAQ 9184 and 9401 digital I/o card, I use the counters available for the measurement of the frequency (pulses are generated by a sensor hall, whose frequency I want to measure to estimate the speed of the motor DC.) But the problem is that thi

  • I can't load videos on my rocket

    I looked on my manual and it says click on the meia converter when it appears, but it never appears. I am a newbie

  • Auto rotate problem

    Hi guys, I recently noticed that my screen does not respond to landscape mode when I tilt the phone... Auto-rotation is enabled, I've never been there before... I see ppl also had this problem, some with the update... What can I do? Thanks in advance

  • Can not boot Vista sp1

    After an unsuccessful attempt to install SP2 (Vista), I tried to restart and received a message from the disk read error/ctrl, alt, delete to start, which will of course returned to ctrl, alt, delete to start. I did the system diagnostics and got 3 e