Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to detect a polygon text area

Guest
Jun 01, 2009 Jun 01, 2009

In my script I am looking at each textFrame to determine its alignment and orientation. No problem here. But, I also need to determine if the artist has specified a polygon rather than the standard rectangle for the text area. Is there a way to do this in the script?

Thanks in advance - Steve

TOPICS
Scripting
1.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Jun 01, 2009 Jun 01, 2009

Have you tried looking at the path item/entire path properties of the text frame. Seems like more than 4 would indicate a polygon (except for 8 which could be a rounded rectangle).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 01, 2009 Jun 01, 2009

Larry - thanks for the suggestion but I wasn't able to get the following to work:

confirm(sourceDoc.textFrames.pathItem.entirePath)

or

confirm (sourceDoc.textFrames.pathItem.pathPoints)

I receive the "undefined is not an object" error message.

It is probably of note that I am only looking at textFrames that meet the following criteria:

kind == 'TextType.AREATEXT'

Also - I am scripting for CS3 not CS4 should this be a new property.

Am I doing something wrong? Or do I need to upgrade to CS4?

Steve

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 01, 2009 Jun 01, 2009

Hi Steve, you can accomplish that by comparing the area property of the TextPath against your own square calculated area (width * height), if they are different then it is a polygon.

' // code

    A = YourTextFrame.TextPath.Area

    W = YourTextFrame.TextPath.Width

    H = YourTextFrame.TextPath.Height

     if A = W*H then

          msgbox "it is a square"

     else

          msgbox "it is a polygon"

     end if

' // end code

sorry, I only do VB, but you get the idea to turn it into JS or AS

CarlosCanto

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 02, 2009 Jun 02, 2009

Carlos - I'm not able to get this to work because when I try to look at textFrame.textPath.Area I get the error message "The requested property is not available for this type of text frame.

I don't think textPath is valid for text frames that are of type AREATEXT as these text frames are.

Does that seem right or am I doing something incorrectly?

Steve

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 02, 2009 Jun 02, 2009

Area is not a property of a textFrame. Geometric bounds and height and width are.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 02, 2009 Jun 02, 2009
LATEST

Hi Larry, Area is not a property of a textFrame. Area, as well as width and height are properties of textPath, which in turn is a property of textFrame.

CarlosCanto

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 02, 2009 Jun 02, 2009

Hi Steve, you're getting that error message when trying to run the script on a pointText type of frame, I just made a test and it works fine with TextFrames of kind AreaText, it even works on PathText TextFrames. Create a document with only one AreaText TextFrames and run the script to make sure it works.

let me know how it goes

CarlosCanto

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines