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

Hyphenation Settings slider

New Here ,
Jan 28, 2025 Jan 28, 2025

Copy link to clipboard

Copied

Hi,

 

I've created a simple script that will apply some Hyphenation and Justification Settings but I'm having trouble accessing that slider from Hyphenation Settings. Does anyone know how to set a value for it?

Thanks in advance.

 

TOPICS
Scripting

Views

83

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 , Jan 28, 2025 Jan 28, 2025

You're looking for "hyphenWeight".

 

I can't tell you exactly how you can use it without knowing more about what you're trying to do. But, for example, imagine you had dozens of paragraph styles to edit, and you didn't want to have to click around manually like some pixel-stained technopeasant wretch. You might want to write a script to e.g. step through all your paragraph styles and slam the slider to "Better Spacing" in all of 'em. You'd want to loop through all paragraph styles, except that I

...

Votes

Translate

Translate
Community Expert ,
Jan 28, 2025 Jan 28, 2025

Copy link to clipboard

Copied

It is part of the paragraph styles? Why scripting? Adust and work with paragraph sryles. 

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
New Here ,
Jan 28, 2025 Jan 28, 2025

Copy link to clipboard

Copied

Thanks. I know it's part of the paragraph styles but for my purpose I need to access that via scripting.

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
Community Expert ,
Jan 28, 2025 Jan 28, 2025

Copy link to clipboard

Copied

You're looking for "hyphenWeight".

 

I can't tell you exactly how you can use it without knowing more about what you're trying to do. But, for example, imagine you had dozens of paragraph styles to edit, and you didn't want to have to click around manually like some pixel-stained technopeasant wretch. You might want to write a script to e.g. step through all your paragraph styles and slam the slider to "Better Spacing" in all of 'em. You'd want to loop through all paragraph styles, except that I assume you wouldn't want to touch paragraph style 0 (that's "No Paragraph Style") and paragraph style 1 (that's "[Basic Paragraph Style]").

 

So your script would look like this:

for (i=2; i < document.allParagraphStyles.length; i++) {
  document.allParagraphStyles[i].hyphenWeight = 0
}

 

If you wanted the slider at the other end ("Fewer Hyphens") then you'd want to set hyphenWeight to 10.

 

You can find hyphenWeight in a lot of places besides allParagraphStyles; I'd suggest that you search someplace like indesignjs.de/extendscriptAPI/indesign-latest/, and see which object(s) are most applicable to your situation. 

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
New Here ,
Jan 29, 2025 Jan 29, 2025

Copy link to clipboard

Copied

LATEST

That's the one. Thanks a lot Joel!

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