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

TextFrameItem nextFrame throws

Explorer ,
Dec 14, 2022 Dec 14, 2022

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

TOPICS
Scripting

Views

299

Likes

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , Dec 14, 2022 Dec 14, 2022

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

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

Likes

Translate

Translate
Community Expert ,
Dec 14, 2022 Dec 14, 2022

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)
}
Best regards

Likes

Translate

Translate

Report

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
Explorer ,
Dec 14, 2022 Dec 14, 2022

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.

Likes

Translate

Translate

Report

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 ,
Dec 14, 2022 Dec 14, 2022

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?

Best regards

Likes

Translate

Translate

Report

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
Explorer ,
Dec 14, 2022 Dec 14, 2022

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

Likes

Translate

Translate

Report

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 ,
Dec 14, 2022 Dec 14, 2022

Copy link to clipboard

Copied

You can share drive or dropbox link, or may be by zipping the ai file.

Best regards

Likes

Translate

Translate

Report

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
Explorer ,
Dec 14, 2022 Dec 14, 2022

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

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 ,
Dec 14, 2022 Dec 14, 2022

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
}
Best regards

Likes

Translate

Translate

Report

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 ,
Dec 14, 2022 Dec 14, 2022

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);

Likes

Translate

Translate

Report

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
Explorer ,
Dec 14, 2022 Dec 14, 2022

Copy link to clipboard

Copied

LATEST

@Charu Rajput and @CarlosCanto, thank you guys, you are awesome!

 

The issue is, as mentioned, that TextFrame cannot be Point Text. 

 

Again, big thanks!

Likes

Translate

Translate

Report

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