Skip to main content
Participating Frequently
May 28, 2008
Question

setting hyphenateAcrossColumns to false for a textFrame

  • May 28, 2008
  • 13 replies
  • 758 views
Hi Everyone,

I only started writing scripts for InDesign yesterday and so I am still getting my head around everything.

I have created a textFrame like so:

var myTextFrame = myDocument.pages.item(0).textFrames.add();

and now, just like when using the UI in InDesign where you can go to the 'Paragraph' panel and uncheck the 'hyphenate' box. I want to do this in the script for this textFrame.

Thanks in advanced for your help.
This topic has been closed for replies.

13 replies

Participating Frequently
May 29, 2008
Thanks guys, you've helped me a lot. I appreciate the time you have taken to answer my questions.

Sorry if I have been frustrating because I'm so new to this!

Thanks again
Inspiring
May 29, 2008
It picks up the style from the insertion point, just as it does in the UI.

Dave
Participating Frequently
May 28, 2008
Ok. Does that mean that everytime any text is added or changed in the textFrame, I need to apply the style to the new text?
Participating Frequently
May 28, 2008
Umm, ok. When textFrames are created are theyby default in a story? or am I supposed to make one first?
Because this line of code didn't work:

myTextFrame.parentStory.texts.item(0).applyStyle(myParagraphStyle, true);

The error I get is: "myTextFrame.parentStory.texts.item().applyStyle is not a function"
Inspiring
May 28, 2008
You can't apply a paragraph style to a text frame, only to the text of the frame or the parent story of the frame or the last insertion point of the frame or the third word of the fourth paragraph of the frame.

appliedParagraphStyle is a text property so it can only be applied to text.

Don't be confused by UI shortcuts. The UI is (like) a huge script that does fancy stuff. You have to work with the basic functionality and make your own fancy stuff.

Dave
Participating Frequently
May 28, 2008
Thanks for helping me Dave.

I'm struggling with applying the paragraph style I have made to my textFrame. How can I do this? All I have on my document is the empty textFrame - It will be filled with an xml element futher down in the code.

Am I able to just apply the style to it? Or do I need to do something tricky?
Known Participant
May 28, 2008
Hi tdiscover,

I'm not sure which script it is, but I expect that the idea is to apply the style to the entire story, empty or not.

Thanks,

Ole
Participating Frequently
May 28, 2008
"in a state of being completely overset" - what does this mean?
Inspiring
May 28, 2008
Presumably because the text frame is empty and it is safer to apply the style to the parentStory just in case the text frame is in a state of being completely overset.

Dave
Participating Frequently
May 28, 2008
I'm going through the Scripting Guide section on applying styles and I am a little confused by this line of code:

myTextFrame.parentStory.texts.item(0).applyStyle(myParagraphStyle, true);

Why is it assigning the paragraph style to the parentStory?