Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Paolo F Cantoni on September 02, 2016, 01:42:01 pm
-
We have a number of versions of EA installed on different machines. On some, we have up to 3 or 4 (if you include lite versions).
On a couple we have Build 909, a version 12 build and the 13_Beta. When we start our VBA automation it looks for the EA.App:
Dim EAapp As EA.App
Set EAapp = GetObject(, "EA.App")
Depending on the machine (and presumably the order of installation) it will only attach to a particular version of EA (typically 909 since that was the first installed).
Any windows Gurus know how to track down the pointer in the registry and have it point to our desired version?
TIA,
Paolo
-
I don't pretend to be a windows guru (or any kind of guru for that matter) but the string EA.App is found as a key in the registry: HKEY_CLASSES_ROOT\EA.App
This key contains a CLSID key with a GUID, in my case {3A9E4F92-8D27-495B-8B22-1D702B3F0C83}
This GUID should lead you to another key in the registry
again in my case
HKEY_CLASSES_ROOT\WOW6432Node\CLSID\{3A9E4F92-8D27-495B-8B22-1D702B3F0C83}
That key contains the following in my case:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\WOW6432Node\CLSID\{3A9E4F92-8D27-495B-8B22-1D702B3F0C83}]
[HKEY_CLASSES_ROOT\WOW6432Node\CLSID\{3A9E4F92-8D27-495B-8B22-1D702B3F0C83}\InprocHandler32]
@="ole32.dll"
[HKEY_CLASSES_ROOT\WOW6432Node\CLSID\{3A9E4F92-8D27-495B-8B22-1D702B3F0C83}\InprocServer32]
"Class"="EA.AppClass"
"Assembly"="Interop.EA, Version=2.10.238.1, Culture=neutral, PublicKeyToken=d28e1c76302f6a17"
"RuntimeVersion"="v2.0.50727"
"CodeBase"="file:///C:\\Program Files (x86)\\Sparx Systems\\EA\\Interop.EA.dll"
[HKEY_CLASSES_ROOT\WOW6432Node\CLSID\{3A9E4F92-8D27-495B-8B22-1D702B3F0C83}\InprocServer32\2.10.238.1]
"Class"="EA.AppClass"
"Assembly"="Interop.EA, Version=2.10.238.1, Culture=neutral, PublicKeyToken=d28e1c76302f6a17"
"RuntimeVersion"="v2.0.50727"
"CodeBase"="file:///C:\\Program Files (x86)\\Sparx Systems\\EA\\Interop.EA.dll"
[HKEY_CLASSES_ROOT\WOW6432Node\CLSID\{3A9E4F92-8D27-495B-8B22-1D702B3F0C83}\LocalServer32]
@="C:\\PROGRA~2\\SPARXS~1\\EA\\EA.exe"
[HKEY_CLASSES_ROOT\WOW6432Node\CLSID\{3A9E4F92-8D27-495B-8B22-1D702B3F0C83}\ProgID]
@="EA.App"
So I guess that's where he gets the location of the assembly.
In case of connecting to the running instance, when you have multiple instances running, I've noticed that he tends to connect the instance that was first started up.
Geert
-
I haven't tested with EA, but as the first parameter of the GetObject function can be set as "The full path and name of the file containing the object to retrieve" - this can be used to specify which version to run.
So the issue is knowing the filename for a specific version. Here are several ideas (I am sure there are more):
- Search the registry in your code to retrieve the path for the desired version - or
- Install EA in specific directory that has the version number e.g. "C:\Program Files (x86)\Sparx Systems V12\EA" - or
- Have a text file which contains the filename which could be read (or use a registry key you could read)
The purest in me would be to search the registry however this is a bit of an overhead. Both the version number and install path are located under each EA install section within
- HKLM or HKCU (depending on installation type) \ Software \ (optionally WoW6432Node) \ Sparx Systems \ EA400 \ EA
The relevant keys are:
NB: I haven't installed Version 13 yet so there may be some changes that I haven't seen yet!
My practical approach would be to install with a version number (but that could be too late and prone to omission when updating etc), ...
Hope this helps.
-
Thanks Geert,
I managed to get that far myself. But changing the path there doesn't seem to do anything. Do I need a reboot?
Since the 909 build has a unique file name, I'll try what MrWappy said and search the registry for that.
Paolo
-
Finally got back to this...
NOTHING we have tried seems to fix this.
The EA.App value seems to require: C:\Program Files (x86)\Sparx Systems\EA_909\EA_909.exe to be active (notwithstanding the entry to Interop.EA.dll)
We want to test our Excel automation against: C:\Program Files (x86)\Sparx Systems\EA_Beta\EA_Beta.exe
We replaced as many occurrences of EA_909 with EA_Beta in the registry as we could, we rebooted immediately, and confirmed all the obvious instances had been changed. (Our registry editor won't fix REG_BINARY entries, but from the looks of them, they shouldn't be the problem).
Nothing seems to work, it always goes back to: C:\Program Files (x86)\Sparx Systems\EA_909\EA_909.exe If that exe file is NOT open, then the automation (via the GetObject) will not see the App. Even though we replaced the EA_909 :-\ with the EA_Beta one in the EA_909 folder.
So, in the end, in desperation, we copied the EA_Beta folder into the EA_909 and renamed the executable and opened that! EA.App now see the v13 EA (in the guise of EA_909.exe).
Can anybody, especially a Sparxian, tell me what's going on?
I don't have any hair left to tear out, but I tried...
TIA,
Paolo