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

Adding user dictionary in InDesing preference-dictionary

Community Beginner ,
Jul 15, 2016 Jul 15, 2016

Copy link to clipboard

Copied

Screen Shot 2016-07-15 at 1.17.01 PM-SANTHOSH.pngHi,

Below are the code i can able to load the user dictionary in PC(windows). For mac its not working.

with(app.dictionaryPreferences){

  //PC////  var fo ="C:/lib/GHM_07_July2016.udc"

  var fo="/Applications/GHM-Dictionary/GHM_07_July2016.udc"

  alert(fo)

app.languagesWithVendors.itemByName('English: USA').addDictionaryPath(File(fo));

}

please guide me.

Thanks in advance...

Regards

AshokInDesign ScriptingScreen Shot 2016-07-15.png

TOPICS
Scripting

Views

2.5K

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 , Jul 26, 2016 Jul 26, 2016

Hi together,

I can add an udc file to languagesWithVendors on my German InDesign.

( The used string "Deutsch: Rechtschreibreform 1996" is "German: Reformed" with an English version of InDesign )

Since the following is not working—I assume it's a bug with my German versions of InDesign:

try{

app.languagesWithVendors.itemByName("Deutsch: Rechtschreibreform 1996").name;

}catch(e){$.writeln("ERROR:"+"\t"+e.message)};

//Result:

// ERROR:    Objekt ist ungültig

// ERROR:    Object is not valid

I have to loop th

...

Votes

Translate

Translate
Engaged ,
Jul 26, 2016 Jul 26, 2016

Copy link to clipboard

Copied

Uwe,

Is there any method to get path in that Mac format: Macintosh HD:path:to:my:file.udc ?
Can't find correct API method for that... Or do we need to manually build it with adding disk name and replace / with :

PS: I think we need to make special model (from MVC) for adding / removing dictionaries based on the system OS and collect such models somewhere in open source GitHub page

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 ,
Jul 26, 2016 Jul 26, 2016

Copy link to clipboard

Copied

oleh.melnyk wrote:

Uwe,

Is there any method to get path in that Mac format: Macintosh HD:path:to:my:file.udc ?
Can't find correct API method for that... Or do we need to manually build it with adding disk name and replace / with :

Hi Oleh,

getting the name of a disk is discussed in the thread I linked to below.

There may be other discussions in this forum as well.

ExtendScript Oddity with File/Folder on Mac OS X

RorohikoKris Feb 6, 2012

https://forums.adobe.com/message/4187884#4187884

Let's see, if we can bring the two tasks together.

Regards,
Uwe

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 ,
Jul 26, 2016 Jul 26, 2016

Copy link to clipboard

Copied

oleh.melnyk wrote:

5. In order to make new dictionary work you need to select text and reapply language, which is a bit weird - and by reapplying I mean apply another language, then apply original lang

Yes, Oleh, item 5 is working, if I switch to "No Language" of a text selected and back to the language where I added the dictionary. However, hyphenation is still a problem. That means: Not to hyphenate a word that is listed in the user dictionary is a problem. Spell checking is working as expected…

Regards,
Uwe

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
Engaged ,
Jul 26, 2016 Jul 26, 2016

Copy link to clipboard

Copied

Uwe,

Have you added hyphenation rules to your custom dictionary?

img-2016-07-26-16-59-11.png

PS: I think it would be great if we could make those user dictionaries synchronize with the server to build a better, up-to-date dictionaries for hyphenation, spell check, title/sentence case etc.

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 25, 2016 Jul 25, 2016

Copy link to clipboard

Copied

Hi oleh.melnyk

Thanks for your effort.

My Problem is on mac.

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 26, 2016 Jul 26, 2016

Copy link to clipboard

Copied

Hi Laubender ,

Thank you very much for your reply.

Just tested it twice and it works.

Regards

Ashok

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
Contributor ,
Jul 26, 2016 Jul 26, 2016

Copy link to clipboard

Copied

Hi Ashok,

Don't forget to pick the correct answer.

Thanks

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
Engaged ,
Jul 26, 2016 Jul 26, 2016

Copy link to clipboard

Copied

Yay! I made it! Now everything works!

Dropbox - User Dictionary.zip

It might look a bit over complicated, but it consists of small reusable building blocks, which is way better than spaghetti code with the all-in-one file... Reusable code is the key for better scripts, which is easier to understand, extend and support.

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 ,
Jul 26, 2016 Jul 26, 2016

Copy link to clipboard

Copied

Hi Oleh,

I still had no time looking much into your scripts ( thank you very much for providing them! ), but be careful with "getDriveName.jsx". Mac OSX allows path and file names using "/" in the names (and I've seen them in projects provided by customers) like that:

"Macintosh HD:test/InDesign:myFileToTest/CS6.indd"

I did not test your script with folder/file names like this.
Just a warning…

Best,
Uwe

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
Engaged ,
Jul 27, 2016 Jul 27, 2016

Copy link to clipboard

Copied

Hi Uwe,

"getDriveName.jsx" should be fine, as it returns just drive name, such as "Macintosh HD".

The problem might be in "pathToMacOS9Style.jsx", which probably should be renamed to "oldMacPath" - this module is for trying to convert the path to old style with colon separator, which was used in Mac OS 9 and below, but Mac OS 9 is not supported since 2002, so this OS's and file path style should be deprecated for at least 14 years! I don't understand why people and software developers, such as Adobe still using it...

For now, I can't find specifications for that format, but if "/" is the only case - I think I can do something with that - right now need more info.

PS: I have found that there's "macpath.py" module, built in Python 2.7 that were made to support that path conversion, but I don't know Python that well to port it to JS, not sure if it helps

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
Engaged ,
Jul 27, 2016 Jul 27, 2016

Copy link to clipboard

Copied

LATEST

Ok, I have renamed old "pathToMacOS9Style.jsx" file to "oldMacPath.jsx" and modified it to handle "/" in file/folder name - now everything should work just fine!

Dropbox - User Dictionary.zip

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