0

I have three textframes with different shapes. One is regular rectangular frame, other is oval and last one is triangular textframe.

I want to find the shape of the text frame. Do anyone know how to find the shape of the textframe?

Thanks in advance.

vDeepak
  • 103
  • 1
  • 5
  • 11

1 Answers1

0

Maybe you try this. Only thing is. There is no object like a triangle. So it always is a Polygon.

if(app.documents.length > 0){
    if(app.selection.length > 0){
        var thing = app.selection[0];
        if(thing instanceof Rectangle){
            alert("I'm an "+ thing.constructor.name);
        }else if(thing instanceof Oval){
            alert("I'm an "+ thing.constructor.name);
        }else if (thing instanceof TextFrame){
            alert("I'm an "+ thing.constructor.name);
        }else if(thing instanceof Polygon){
        // this detect the triangle
            if((thing.paths[0].pathPoints.length > 2)&&(thing.paths[0].pathPoints.length < 4) ){
                alert("I'm an triangle "+ thing.constructor.name);
            }else{
                alert("I'm an "+ thing.constructor.name);
            }
        }
    }else{
        alert("you need to select something on a page");
    }
}else{
    alert("you need a document");  
}
fabianmoronzirfas
  • 4,091
  • 4
  • 24
  • 41