var path = "\\file_server\class_master\sitename\InDesign\Dictionary\Global Dictionary.udc" var var lang = app.languagesWithVendors.itemByName("English: USA"); lang.addDictionaryPath (filePath);
Not quite there.
On first try, got error message, "Illegal use of reserved word 'var'"
Determined that was from duplication of "var" at start of second line.
After removing one of the "var" entries on that line, tried again and got error message, "filePath is undefined."
Changed "(filePath") at end of third line to "(path)", tried again and that did not work.
Changed start of first line to "var filePath" and end of third line back to "(filePath)", tried again and got error message, "Cannot add dictionary path."
Here is the current version of the script that resulted in the "Cannot add dictionary path" error:
var filePath = "
var lang = app.languagesWithVendors.itemByName("English: USA");
Sorry for the typos.
It looks like you need colon notation on Mac for it to work. For example, the following works on my machine:
app.languagesWithVendors.itemByName("English: USA").addDictionaryPath ("Macintosh HD:Users:harbs:Desktop:dictionary.udc");
This is for Windows, not Mac.
Try importing it manually, and copying the exact path to the script.
I have tried again with the desired dictionary simply in a subfolder of the C drive, not on the file server as ultimately desired, and still get the error, "Cannot add dictionary path"
app.languagesWithVendors.itemByName("English: USA").addDictionaryPath ("C:\4JohnW\GlobalDictionary.udc");
You need to escape your path using \\ or use /.
app.languagesWithVendors.itemByName("English: USA").addDictionaryPath ("C:\\4JohnW\\GlobalDictionary.udc");
app.languagesWithVendors.itemByName("English: USA").addDictionaryPath ("C:/4JohnW/GlobalDictionary.udc");
The / would work on the Mac too.
In Windows, a double slash indicates a server or computer name, such as
myfileserver>, and a single slash is used for subfolders, such as
myfileserver\shareddrive\subfolder>. There is no slash of any kind before the drive letter of the computer on which the folder resides, thus C:\JohnW.
In fact, if you specify a dictionary manually that is on the C drive, the list of dictionaries in InDesign shows C:\JohnW.
I will try the forward slash in hopes that might make a difference.
When you type a file path in Windows explorer or use the path in VB or one of it's mutations then you can use the 'C:\John' notation.
This is a general all platform rule that does not relate specifically to file paths, nor does it relate specifically will InDesign.
Thank you, Trevor. After a little more trial and error, I finally got the path to work as desired, which is to a subfolder of a file server, rather than the local computer.
Can you mark either the answers as correct and helpful.