Copy link to clipboard
Copied
Hi Everyone,
I am learning applescripting and it's usage in Adobe Indesign.
I am trying to working on a requirement, where I need to make the language of Indesign document to "English: USA" in the dictionary preferences through script.
I tried to change the language in the preferences but somewhere this below code is going wrong. I took the syntax from the dictonary of indesign in apple-script.
tell application "Adobe InDesign CS4"
change text preferences of dictionary
set applied language to "English:USA"
end tell
Would appreciate if someone can guide me the correct approach.
Thanks in advance!
Abhi...
Copy link to clipboard
Copied
Hi,
it's a bit tricky here.
If you want to change the default for the applied language of a document then use:
app.activeDocument.textDefaults.appliedLanguage = 'Englisch: USA' //Have a look at the character window or create a new paragraphstyle and have look at the language ...
Edit:
Sorry you were looking for a AppleScript ...
I'm not on a Mac at this moment, but should sth. like:
tell application "Adobe InDesign CS4"
tell active document to set applied language of text defaults to language "English: USA"
end tell
Copy link to clipboard
Copied
Hi,
Thanks for looking into it.
Yes indeed it works..
However, can we change the "Adobe Custom Dictionary" through apple script so that language of dictionary preferences gets changed. (if that happens).
I noticed that when we go to path:
Indesign---->Preferences---> Dictionary
The default dictionary has a path in our system library.. (I am still a learner so it's a new thing for me.. )..
The path changes from UK to US dictionary as:
'~/Library/Application Support/Adobe/Linguistics/Dictionaries/Adobe Custom Dictionary/brt--------------> For UK DICTIONARY
'~/Library/Application Support/Adobe/Linguistics/Dictionaries/Adobe Custom Dictionary/eng--------------> For US DICTIONARY
Is it possible that by changing the path we can change the default dictionary in preferences of AppleScript through scripting in Apple.
Just thought whether this can be a possibilty!
Would appreciate if someone can suggest and help me out of here.
Thanks in advance!
Abhi
Copy link to clipboard
Copied
Yes you can 😉
adding a path :
app.languagesWithVendors.itemByName('English: USA').addDictionaryPath(File('~/Desktop/test.txt'));
removing a path :
app.languagesWithVendors.itemByName('English: USA').removeDictionaryPath(File('~/Desktop/test.txt'));
get all paths:
app.languagesWithVendors.itemByName('English: USA').dictionaryPaths //notice: it's a array of paths as one language can have several dictionaries
Theres no need to script ID by AS, you can use JS as the support by adobecommunity is better, but it can easily be adapted
If you've got problems in finding the rigth AS-Syntax -> call again!
Hans-Gerd Claßen
Copy link to clipboard
Copied
Hi Hans-Gerd Claßen,
Thanks so much for looking into it and helping me out.
To be honest, I am not aware of Java Scripting so it is bit difficult for me to use the said codes as of now.
However, I would really appreciate if you could suggest me if this is possible by AS.
I am also working for any syntaxes in AS for this case, but till now no success.
Regards,
Abhi
Copy link to clipboard
Copied
Hi,
here we go:
set customUserDictionary to (choose file without invisibles) as text --should be *.udc!
tell application "Adobe InDesign CS4"
set myLanguageWithVendors to item 1 of (languages with vendors whose name is "Englisch: USA")
add dictionary path myLanguageWithVendors file path customUserDictionary
end tell
Hope it helps
Copy link to clipboard
Copied
Thanks!
I will have a look into it.
Looking at the first line of code it asks for choosing files from a path.
As you mentioned in the comment's field, we need to have a .udc file for it. But I couldn't locate them. Are these hidden files.....
Also do we need choose file always for Custom Dictionary... can't we have a direct link to English USA (as what i want finally is that whoever user runs this script his language in the default preference get sets to English: USA)....
~/Library/Application Support/Adobe/Linguistics/Dictionaries/Adobe Custom Dictionary/
Thanks again for your continued help .. I really appreciate your support and guidance
Regards,
Abhishek
Copy link to clipboard
Copied
Good morning,
I guess your messing up some things (or I do 😉 ) ...
Under preferences dictionionaries the properties of each language can be set. Doesn't matter for your documents what's actually chosen, but what matters are the properties that are set for each there ...
So, if you want any user to start with "English: USA" you've got to set text defauls as mentioned in a post above.
Path : '~/Library/Application Support/Adobe/Linguistics/Dictionaries/Adobe Custom Dictionary/anyLanguageFolder' can't be changed but entries can be exported. Add them to yourNew-udc-file. Add this file ...
Hans-Gerd Claßen
Copy link to clipboard
Copied
Thanks for your reply..
I will have a look into it.
I am bit novice to indesign scripting... hence the reason I aksed...
Thanks for your help and guidance!
Have a nice day!
Abhishek