0 Replies Latest reply on Aug 13, 2013 6:10 AM by surendarappu

    help to clear error in my script

    surendarappu Level 1

      Hi

      Here is my code to find cmyk values for selected object,I get the answers in alert window perhaps i want to get the values in rectangle filled with selected value inseted of alert window

      i want to draw a rectangle, rect = myDocument.pathItems.rectangle( 20, 20, 20, 20 ); rectangle must be some where outside artboard and fill first selected color in below code and followed by next

       

      can anyone help me to modify below code and bring exact output i required

       

      var docRef = app.activeDocument;
      var iL=docRef.pageItems.length;
      var mytext=docRef.textFrames.add();

      for (i=0;i<iL;i++)
      {
           myItem=docRef.pathItems[i];
              
                if (myItem.fillColor=="[CMYKColor]" && myItem.selected)
                {
       
                  var c=myItem.fillColor.cyan;
                  var m=myItem.fillColor.magenta;
                  var y=myItem.fillColor.yellow;
                  var k=myItem.fillColor.black;
                  //alert ("pathItem number:"+i+" \n cyan: "+c+" \n magenta: "+m+" \n yellow: "+y+" \n black: "+k);

                  rec();
                }
      }

       

      i have an idea but i don't know how to come out with code, my idea is

       

      function rec()

      {

      var rect = docRef.pathItems.rectangle(100,-100,26,26) ;

      var col= new CMYKColor();

      col.cyan = c;

      col.magenta = m;

      col.yellow = y;

      col.black = k;

      rect.fillColor=col;

      }

                 

      but i don't know its right

      please help me i'm trying this for last 2 days i couldn't get this

      i would be thankful for you

       

      Thank you

      Appu