• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit Search
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

232

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 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

LATEST

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