Skip to main content
August 12, 2013
Question

help to clear error in my script

  • August 12, 2013
  • 0 replies
  • 318 views

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;
        
          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

This topic has been closed for replies.