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

inline anchor in a textFrame (jsx)

Explorer ,
Sep 13, 2019 Sep 13, 2019

Copy link to clipboard

Copied

I'm trying to add a small circle as an inline object, but something's off. I suspect its my insertion point, but I'm not sure.  Can anyone help?

var myPage = app.activeDocument.layoutWindows[0].activePage;
var bounds = {geometricBounds:[10,10,20,20]};
var content = " Lorem Ipsum";

var myTextFrame = createTextFrame(bounds,content);
var insertPoint = myTextFrame.parentStory.insertionPoints[0]; //I think the problem may be here
var circle = insertPoint.ovals.add({geometricBounds:[55, 10, 55.5, 10.5]}); 

function createTextFrame(myTextFrameBounds, myTextFrameContents){
    var myFrame = myPage.textFrames.add(myTextFrameBounds);
    myFrame.contents = myTextFrameContents;
} 

 

TOPICS
Scripting

Views

736

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

Advisor , Sep 13, 2019 Sep 13, 2019

The problme is that your "createTextFrame" function does not actually return a textframe.
Add a "return myFrame;" at the end of it and you should be ready to go.

 

This new forum is HORRIBLE!!!

Votes

Translate

Translate
Community Expert ,
Sep 13, 2019 Sep 13, 2019

Copy link to clipboard

Copied

What goes in the circle? A picture? Why must it be scripted?

Mike Witherell

Votes

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 ,
Sep 13, 2019 Sep 13, 2019

Copy link to clipboard

Copied

Its beyond infuriating that this reply box is not multiline ... Anyway. It's just a circle with a tint. It is part of a much larger script that builds out a timeline, from data. The circles are the "key" that goes in the textFrame above the timeline bar.

Votes

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
Advisor ,
Sep 13, 2019 Sep 13, 2019

Copy link to clipboard

Copied

The problme is that your "createTextFrame" function does not actually return a textframe.
Add a "return myFrame;" at the end of it and you should be ready to go.

 

This new forum is HORRIBLE!!!

Votes

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 ,
Sep 13, 2019 Sep 13, 2019

Copy link to clipboard

Copied

LATEST
That's the fix! I don't know if there is a way to mark this a solved but gold stars for you! :star:️:star:️:star:️

Votes

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