Skip to main content
Inspiring
December 14, 2022
Answered

TextFrameItem nextFrame throws

  • December 14, 2022
  • 1 reply
  • 1068 views

Hey guys,

I've been going through the documentation on using (docs)

 

TextFrameItem.nextFrame

 

From the docs as well:

- When you create a text frame, you also create a Story object.

- However, threading text frames combines the frames into a single story object.

- To thread frames, use the nextFrame or previousFrame property.

 

When I try to access this property on a TextFrame that I have I get the following error:

 

The requested property is not available for this type of text frame.

 

 

Has anyone else encoutered this error? My guess is that this means that there is no nextFrame to follow so I can just ignore it

This topic has been closed for replies.
Correct answer Charu Rajput

Try this link, it seems to be uploaded for 30 days link


It is point text, so if you can add the check 

if(_textFrameItem.kind != TextType.POINTTEXT){
// check for nextFrame or previousFrame
}

1 reply

Charu Rajput
Community Expert
Community Expert
December 14, 2022

Hi, I am getting the nextFrame for every textFrame but previousFrame is null if textrame is not threaded. Try folloing if that helps you in your workflow.

var _textFrameItem = app.selection[0];
if (_textFrameItem.nextFrame != null) {
    var _nextFrame = _textFrameItem.nextFrame;
    alert(_nextFrame.contents)
}
if (_textFrameItem.previousFrame != null) {
    var _previousFrame = _textFrameItem.previousFrame;
    alert(_previousFrame.contents)
}
Best regards
JSuXAuthor
Inspiring
December 14, 2022

Hey @Charu Rajput,

 

Thank you for taking the time to assist with the manner.

 

Unfortunately, this check will throw an exception

_textFrameItem.nextFrame != null

 

My main goal with this is to understand why and on what condition it throws. I guess it's due to how the text is created within Illustrator.

 

For now, I am wrapping it in a try/catch block.

Charu Rajput
Community Expert
Community Expert
December 14, 2022

Wrapping in try and catch is the correct solution. Could you please share your ai file to see how you created the textframe where you get this error?

Best regards