Author Topic: Detect EA Version in script  (Read 313 times)

PeteC

  • EA User
  • **
  • Posts: 72
  • Karma: +1/-0
    • View Profile
Detect EA Version in script
« on: September 27, 2022, 07:27:34 pm »
Is it possible to detect the version of EA?

I specifically need to avoid using the JScript-Dialog library in 64-bit EA (as it doesn't work). As there is a workaround (but less ideal) using Session.Input, I would like to detect if EA is 32-bit or 64-bit. I can then either use the JScript-Dialog library or create a similar input dialog using Session.Input.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 12073
  • Karma: +471/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Detect EA Version in script
« Reply #1 on: September 27, 2022, 07:41:21 pm »
The version of EA is easy:
Code: [Select]
Repository.LibraryVersion
The bitness (32 or 64 bit) might be a bit harder. If the version is lower than 16, you are sure it's 32 bit.

Other than that I wouldn't really know. If you find the answer please post it here. I can imagine I'm going to need that one time or another.

Geert

PeteC

  • EA User
  • **
  • Posts: 72
  • Karma: +1/-0
    • View Profile
Re: Detect EA Version in script
« Reply #2 on: September 27, 2022, 11:24:44 pm »
Making an assumption (that if the ActiveXObject fails it's 64-bit!), this JScript code works:

Code: [Select]
function TestEAVersion()
{
try
{
var vbe = new ActiveXObject("ScriptControl");
// Success = 32-bit? (Assumption)
return 32;
}
catch (err)
{
// Fail = 64-bit? (Assumption)
return 64;
}
}

For me, it provides the expected result for EA15, EA16 32-bit and EA16 64-bit. Obviously the assumption might be wrong and it fails for some reason on a 32-bit system and would then offer the answer as 64.