Home Forums General XMetaL Discussion Get current localization of XMetaL Author from JScript Reply To: Get current localization of XMetaL Author from JScript

Derek Read

Reply to: Get current localization of XMetaL Author from JScript

There is no API for this, but starting with version 7.0 the following key is set in the registry for the particular version of XMetaL Author Essential or XMetaL Author Enterprise you have installed.

HKEY_LOCAL_MACHINESOFTWARESoftQuadXMetaL 7.0Install_Language
HKEY_LOCAL_MACHINESOFTWARESoftQuadXMetaL 8.0Install_Language

You can use the standard Windows “WScript.Shell” ActiveX object to read from the registry, so a script similar to the following JScript example should give you what you need:

[code]//XMetaL Script Language JScript:
function registryReadKey(regKey) {
try {
var wShell = new ActiveXObject(“WScript.Shell”);
var keyVal = wShell.RegRead(regKey);
wShell = null;
return keyVal;
}
catch(e) {
//no value set or something else went wrong, fail silently
}
}
var xmVersion = Application.VersionNumber;
var xmLocale = registryReadKey(“HKEY_LOCAL_MACHINE\SOFTWARE\SoftQuad\XMetaL ” + xmVersion + “\Install_Language”);
Application.Alert(xmLocale);[/code]

I believe standard two letter localization values are used such as EN, DE, FR and JP.

Reply

Products
Downloads
Support