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

Fill Proportionally all anchored frames to content

Guest
Nov 07, 2009 Nov 07, 2009

Hi,

there's a way to Fill all anchored text Frame Proportionally to content  (> 1000 anchored frames)?

Thanks for help

TOPICS
Scripting
1.3K
Translate
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
Guide ,
Nov 07, 2009 Nov 07, 2009

I'm not sure to understand what you mean by "Fill proportionally to content", but you can fit (anchored text) frames to content:

var isAnchoredTextFrame = function(o)
     {
     if (o.constructor != TextFrame) return false;
     return (o.parent.constructor == Character);
     }

var pItems = app.activeDocument.allPageItems;

while (p=pItems.pop())
     if (isAnchoredTextFrame(p))
          p.fit(FitOptions.frameToContent);

There may be a better way to implement isAnchoredTextFrame(). Our fellow scripters will tell us...

@+

Marc

- - -

http://www.indiscripts.com

Translate
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 ,
Nov 07, 2009 Nov 07, 2009

The OP might mean

p.fit (FitOptions.FILL_PROPORTIONALLY);

I see nothing wrong with your way of collecting anchored frames 🙂

Translate
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
Guide ,
Nov 07, 2009 Nov 07, 2009

[Jongware] wrote:

The OP might mean

p.fit (FitOptions.FILL_PROPORTIONALLY);

In a text frame ??

Translate
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 ,
Nov 08, 2009 Nov 08, 2009
LATEST

Huh. I should've read more than just the title 😛 (After reading the entire post -- guess you're right...)

Translate
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
LEGEND ,
Nov 07, 2009 Nov 07, 2009

There may be a better way to implement isAnchoredTextFrame(). Our

fellow scripters will tell us...

I think the most direct (and quickest) way is:

app.documents[0].stories.everyItem().textFrames.everyItem();

Harbs

Translate
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
Guide ,
Nov 07, 2009 Nov 07, 2009

Harbs, you're the best 😉

@+

Marc

Translate
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
LEGEND ,
Nov 07, 2009 Nov 07, 2009

Aw Shucks!

But don't forget that before CS3, the textFrames of a story were what is now the textContainers...

I think that for it to work in CS2, you had to do:

doc.stories.everyItem().texts.everyItem().textFrames.everyItem();

But my memory might be faulty on the exact working code...

Translate
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