我有三个不同形状的文本框。一个是常规矩形框,另一个是椭圆形,最后一个是三角形文本框。
我想找到文本框的形状。有谁知道如何找到文本框的形状?
提前致谢。
我有三个不同形状的文本框。一个是常规矩形框,另一个是椭圆形,最后一个是三角形文本框。
我想找到文本框的形状。有谁知道如何找到文本框的形状?
提前致谢。
也许你试试这个。唯一的事情是。没有像三角形这样的物体。所以它总是一个多边形。
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");
}