Copy link to clipboard
Copied
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
It is point text, so if you can add the check
if(_textFrameItem.kind != TextType.POINTTEXT){
// check for nextFrame or previousFrame
}
Copy link to clipboard
Copied
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)
}
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
I'm getting an error trying to upload it
The attachment's nextframe_throws2.ai content type (application/postscript) does not match its file extension and has been removed.
Will check later if I can upload it
Copy link to clipboard
Copied
You can share drive or dropbox link, or may be by zipping the ai file.
Copy link to clipboard
Copied
Try this link, it seems to be uploaded for 30 days link
Copy link to clipboard
Copied
It is point text, so if you can add the check
if(_textFrameItem.kind != TextType.POINTTEXT){
// check for nextFrame or previousFrame
}
Copy link to clipboard
Copied
is your text Point text?
previousFrame, nextFrame only applies to Threaded Area Text frames.
var idoc = app.activeDocument;
var sel = idoc.selection; // select 2 Area Text Frames
var frame1 = sel[0];
var frame2 = sel[1];
// link frame2 to frame1
frame1.nextFrame = frame2;
alert(frame1.nextFrame.contents);
alert(frame2.previousFrame.contents);
Copy link to clipboard
Copied
@Charu Rajput and @CarlosCanto, thank you guys, you are awesome!
The issue is, as mentioned, that TextFrame cannot be Point Text.
Again, big thanks!