Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 72601

Re: Get Clipping Path dimensions

$
0
0

Hey man, I found a mistake, the code only worked when the object was clipping mask, I fixed already putting a try catch to solve, enjoy:

 

var doc = app.activeDocument;   
var sel = app.activeDocument.selection; 
var selLength = sel.length;
var piobj = doc.placedItems;   


for(i=0; i<selLength; i++){    app.activeDocument.selection = sel[i];    for(j = 0; j<piobj.length; j++){           //Check to see if it is selected           if(piobj[j].selected == true){               //Here I pass the piobj to a function that gets its name, location and places the text above it.           var offsetUP = .7 * 72;            var aLayer = doc.activeLayer;            var tagText =  aLayer.textFrames.add();            tagText.contents = piobj[j].file.name;            try{        tagText.top = app.activeDocument.selection[0].pageItems[0].top + offsetUP;            tagText.left = (app.activeDocument.selection[0].pageItems[0].left + (app.activeDocument.selection[0].pageItems[0].width /2)) - (tagText.width /2);            }catch(e){        tagText.top = app.activeDocument.selection[0].top + offsetUP;            tagText.left = (app.activeDocument.selection[0].left + (app.activeDocument.selection[0].width /2)) - (tagText.width /2);            };        };       };       
};

Viewing all articles
Browse latest Browse all 72601

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>