4 Replies Latest reply on Jul 19, 2012 2:50 AM by AI_learner

    Typename of the filled color.

    AI_learner Level 1

      Hi all,


      I am trying to use the property "typename" with the fillcolor. I am using following statement:




      It'll give error i.e. access of undefined property typename.


      Is there any way of finding the typename of fillcolor?


      Actually, I want to get the type of fillcolor used in pathitem, i.e. is it "GradientColor", "PatternColor" or "SpotColor".

      can anyone help me with this?



        • 1. Re: Typename of the filled color.
          Muppet Mark Level 5

          var doc = app.activeDocument;

          $.writeln( doc.groupItems[0].compoundPathItems[0].pathItems[0].fillColor.typename );

          • 2. Re: Typename of the filled color.
            AI_learner Level 1

            Actually, I am scripting with javascript.
            I tried your code as follows:


            var doc = app.activeDocument;



            But, here "groupItems[0]" returns "null".


            Then I did some modification and used above code as follows:



            which gives an error  i.e.


            "Access of possibly undefined property typename through a reference with static type com.adobe.illustrator:Color. "


            Please help me with this.


            • 3. Re: Typename of the filled color.
              Muppet Mark Level 5

              I think you keep mixing ActionScript syntax with ExtendScript ( what users in this forum use )…

              The latter we can help with but I only just started learning ActionScript myself… ( to create propper panels )

              Help use help you… Which are you using and what are you trying to do?

              • 4. Re: Typename of the filled color.
                AI_learner Level 1

                Till now i think that i am mixing actionscript syntax with Javascript  .  Thanx, for ur help Mr. Mark, may be smone else hv any idea about it nd i got my answer if m lucky ...


                I am using creative suite extension builder.
                I searched a lot and find the following code:



                1. for(var j=0; j < totalSelected; j++) 
                2.     var currentObject = app.activeDocument.selection[j]; 
                4.     if(currentObject.typename == "PathItem"
                5.     { 
                6.         if(currentObject.filled==true &&  
                7.            currentObject.fillColor.typename == "SpotColor"
                10.                     //perform color conversion here  
                11.             }  
                14. }//endfor


                Using above code will give an error on line no. 8.
                I jst want to get the value of type of fillcolor any how.