[ExtendScript] app.languagesWithVendors.itemByName fails.
Adobe Indesign 20.5 on MacOS 15.6.1
To reproduce:
- run the following script:
(function () {
var targetLanguageName = 'Dutch: 2005 Reform';
// try to get the language the normal way
var targetLanguage = app.languagesWithVendors.itemByName(targetLanguageName);
if (!targetLanguage.isValid)
alert('Language "' + targetLanguageName + '" is invalid when accessed via `itemByName`.');
else
return;
// now loop over the languages checking the name each time
for (var i = 0; i < app.languagesWithVendors.length; i++)
if (app.languagesWithVendors[i].name === targetLanguageName)
targetLanguage = app.languagesWithVendors[i];
if (targetLanguage.isValid)
alert('Language "' + targetLanguageName + '" is valid when accessed by index.');
})();
Expected result: that app.languagesWithVendors.itemByName returns a valid language for "Dutch: 2005 Reform" and the script exits quietly.
It returns an invalid object. But note that we can get the valid language directly by looping over each language.
See also this forum thread.
2
votes
