Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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).
Copy link to clipboard
Copied
Larry - thanks for the suggestion but I wasn't able to get the following to work:
confirm(sourceDoc.textFrames
or
confirm (sourceDoc.textFrames
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Carlos - I'm not able to get this to work because when I try to look at textFrame
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
Copy link to clipboard
Copied
Area is not a property of a textFrame. Geometric bounds and height and width are.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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
Find more inspiration, events, and resources on the new Adobe Community
Explore Now