OK so I have a very basic script below that does a Fit Frame to Content which is designed for text frames:
fitthisOnegivenframe to content
The problem with using Fit Frame to Content on text frames is that it only works on the height, it won't adjust the width, unless it is one line of text within the text frame. I want to write the script so that it works in a similar manner to double clicking the bottom right handler of the text frame, where it fits the height and width to the longest sentence. Does anyone know of a quick easy way to do this? I was hoping to not have to calculate the length of each sentence/line break in the frame, finding the longest and changing the geometric bounds of the text frame to match.