2012-09-12 3 views
0

나는 모양이 다른 3 개의 텍스트 프레임을 가지고 있습니다. 하나는 규칙적인 직사각형 프레임이고 다른 하나는 타원형이며 마지막 하나는 삼각형 텍스트 프레임입니다.텍스트 프레임의 모양을 찾는 방법

텍스트 프레임의 모양을 찾고 싶습니다. 누구든지 텍스트 프레임의 모양을 찾는 방법을 알고 있습니까?

미리 감사드립니다.

답변

0

어쩌면 이것을 시도해보십시오. 유일한 것은입니다. 삼각형과 같은 물체는 없습니다. 그래서 항상 다각형입니다.

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"); 
}