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

hyphenationExceptions in Dictionary

New Here ,
Jun 13, 2022 Jun 13, 2022

Copy link to clipboard

Copied

Indesign javascript object model returns incorrect name for the below line,

 

app.documents[0].hyphenationExceptions.itemByName("English: UK").name.

 

It returns,

English: USA.

 

How it is possible. 

 

Regards,

Dillibabu.

TOPICS
Scripting

Views

581

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 ,
Jun 13, 2022 Jun 13, 2022

Copy link to clipboard

Copied

Hi @dillibabum29191024 , Looks like the entire collection is off by 1:

 

$.writeln("Looking for Bulgarian — " + app.documents[0].hyphenationExceptions.itemByName("Bulgarian").name + "\r\r")
var h = app.documents[0].hyphenationExceptions


for (var i = 0; i < h.length; i++){
    $.writeln(h[i].name)
};   


/* Return

Looking for Bulgarian — Catalan

bn_IN
gu_IN
hi_IN
kn_IN
ml_IN
mr_IN
or_IN
pa_IN
ta_IN
te_IN
Bulgarian
Catalan
Czech
Danish
German: Swiss
de_CH_2006
German: Reformed
de_DE_2006
Greek
English: Canadian
English: UK
English: USA
English: USA Medical
Spanish: Castilian
Estonian
Finnish
French: Canadian
French
Croatian
Hungarian
Italian
Lithuanian
Latvian
Norwegian: Bokmal
Dutch
nl_NL_2005
Norwegian: Nynorsk
Polish
Portuguese: Brazilian
Portuguese: Orthographic Agreement
Portuguese
Romanian
Russian
Slovak
Slovenian
Swedish
Turkish
Ukrainian */

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 Beginner ,
Jul 20, 2023 Jul 20, 2023

Copy link to clipboard

Copied

As noted in this other thread about hyphenation exceptions added to the “All languages” language, I wonder if this bug is the reason why there seems to not exist scripting support to access only the hyphenation exceptions, even though there is for words added to all other languages. As if some parts of the code did account for the “All languages” language (which inside IDML files it is named “Neutral”) but not others and that's why “the entire collection is off by 1”.

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 Beginner ,
Jul 20, 2023 Jul 20, 2023

Copy link to clipboard

Copied

LATEST

I meant to write “…to access only those hyphenation exceptions…”.

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 ,
Jun 13, 2022 Jun 13, 2022

Copy link to clipboard

Copied

You might have to write your own function

 

 

var hbn = getHEByName("English: UK")
$.writeln(hbn.name)


/**
* Get Hyphenation Exception by Name 
* @ param name to get 
* @ return hyphenation exception 
* 
*/
function getHEByName(n){
    var h = app.documents[0].hyphenationExceptions;
    var he
    for (var i = 0; i < h.length; i++){
        if (h[i].name == n) {
            he = h[i]
        } 
    };   
    return he
}

 

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 ,
Jun 13, 2022 Jun 13, 2022

Copy link to clipboard

Copied

Thank you. We can write a custom function to get by name. But what is the use of  the below,

hyphenationExceptions.itemByName()

 I want to mention the above line is working wrong.

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 ,
Jun 13, 2022 Jun 13, 2022

Copy link to clipboard

Copied

But what is the use of the below

 

Looks like a bug

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 ,
Jun 13, 2022 Jun 13, 2022

Copy link to clipboard

Copied

Bug confirmed!

Just tested this with my German InDesign 17.3.0 on Windows 10.

 

Thanks for bringing this up.

The bug should be reported at Adobe InDesign UserVoice:

https://indesign.uservoice.com/forums/913162-adobe-indesign-sdk-scripting-bugs-and-features

 

Regards,
Uwe Laubender
( Adobe Community Professional )

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 ,
Jun 13, 2022 Jun 13, 2022

Copy link to clipboard

Copied

This line will fail with an error:

try{
doc.hyphenationExceptions.itemByName( "Arabic" ).name;
}catch(e)
{
	$.writeln( "ERROR: " + e.number +", "+ e.message );
}

// RESULT: "ERROR: 1, name"

 

Because Arabic is listed as the last entry in the collection of hyphenation exceptions.

At least with my installed German InDesign 2022 version 17.3.0 on Windows 10.

 

The bug is very old. Can see it already with InDesign CS6 version 8.1.

 

Regards,
Uwe Laubender
( Adobe Community Professional )

 

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