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

    Typename of the filled color.

    AI_learner Community Member

      Hi all,

       

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

       

      grp.compoundPathItems.index(j+1).pathItems.index(0).fillColor.typename

       

      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?

       

      Thanks

        • 1. Re: Typename of the filled color.
          Muppet Mark Community Member

          var doc = app.activeDocument;

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

          • 2. Re: Typename of the filled color.
            AI_learner Community Member

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

             

            var doc = app.activeDocument;

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

             

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

             

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

            doc.groupItems.index(0).compoundPathItems.index(0).pathItems.index(0).fillColor.typename 

             

            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 Community Member

              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 Community Member

                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]; 
                3.      
                4.     if(currentObject.typename == "PathItem"
                5.     { 
                6.         if(currentObject.filled==true &&  
                7.            currentObject.fillColor.typename == "SpotColor"
                8.           
                9.  
                10.                     //perform color conversion here  
                11.             }  
                12.    
                13.  
                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.

                 

                Thanx....