Skip to main content
Known Participant
December 21, 2012
Question

Clipping Path info

  • December 21, 2012
  • 1 reply
  • 1488 views

Hello guys,

Again I am coming with a need for help now.

I need a automation or plugin or script for spotting error on Photoshop paths.

I tried photoshop scripts, searched for options in indesign and other softwares like pdf preflights. I couldn't find any idea.

I will be working with lots of images more or less 100 images a day. I want to get the infos of clipping paths created in photoshop like path name, clipping flatness and open paths if any, all details in a log file or an log display window. Not an issue whether it works inside photoshop or outside like automation along with other softwares. But I simply need to spot the open path and clipping path name exactly.

Need help!!!

Thank you in advance!

Regards,

Purushoth...

This topic has been closed for replies.

1 reply

Inspiring
December 21, 2012
function clippingPathIndex(){// returns -1 if no clipping path
  var ref = new ActionReference();
  ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
  var desc = executeActionGet(ref);
  return desc.getObjectValue(stringIDToTypeID('clippingPathInfo')).getInteger(stringIDToTypeID('clippingPathIndex'));

};

function getClippingPathFlatness(){ 
  var ref = new ActionReference()
  ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
  var desc = executeActionGet(ref);
   if( desc.getObjectValue(stringIDToTypeID('clippingPathInfo')).getInteger(stringIDToTypeID('clippingPathIndex')) != -1  ){
     return (desc.getObjectValue(stringIDToTypeID('clippingPathInfo')).getInteger(stringIDToTypeID('clippingPathFlatness'))/65536);
  }else{
    return -1;
}

};

var pathIndex = clippingPathIndex();

if(pathIndex != -1 ){
  var pathName = app.activeDocument.pathItems[pathIndex].name;
  var flatness = getClippingPathFlatness();
  var closed = app.activeDocument.pathItems[pathIndex].subPathItems[0].closed;
  alert(pathName+': '+flatness+': '+closed);

}

Known Participant
May 16, 2013

Hello Mike,

Path name and flatness works great. But closed is not working. I want to know whether the path is completed or not. I mean joined. I have attached a snapshot. Pls advise.

Thank you!

Purushoth.

Inspiring
May 16, 2013

I tried Mike's code and it worked just fine here…?