Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Barrie Treloar on August 03, 2023, 10:20:56 am
-
I'm working with Geert's EA-Matic and when those scripts are run in an Addin environment the Session object is not in the global scope.
See https://sparxsystems.com/enterprise_architect_user_guide/16.0/add-ins___scripting/session_object.html (https://sparxsystems.com/enterprise_architect_user_guide/16.0/add-ins___scripting/session_object.html)
But I can't find anything in the Enterprise Architect Object Model
Reference (https://sparxsystems.com/enterprise_architect_user_guide/16.0/add-ins___scripting/reference.html (https://sparxsystems.com/enterprise_architect_user_guide/16.0/add-ins___scripting/reference.html)) that will return me a Session object so I can place it into the Addin scope.
Does anyone know how I retrieve Session from another Object Model reference?
-
Not sure what you are doing. But when you run a script externally you need to ask Mickeysoft to return an OLE which can be a running session or it can create one (to start EA). Depends on the language you are using which library operation is offered here.
q.
-
Geert's EA-Matic is running as an Addin. So everything that is VBScript within EA-Matic is loaded into the EA-Matic Addin's process space to run.
When EA runs a script, it looks like it adds Session as a global object.
But I can find nothing in the Enterprise Architect Object Model Reference for Session, and thus can find no way to add Session as a global object for EA-Matic.
As a workaround I'm transmogrifying Session.Output to Repository.WriteOuput, once I pass through RegEx hell to cope with VBScript line concatentation and optional parenthesis usage for one arg subroutines...
-
There seems to be a Session object in EA's J-stuff. However, I can't help with VB since I rather chop me another finger than writing that...
Maybe Geert will catch up when he's back from his (longer) holidays.
q.
-
Thanks for looking.
I've got my workaround working.
EA's J-stuff is the same as EA's VB-stuff, which EA automatically adds the global Session into scope for you.
But what I need the Session for is EA's addin-stuff, because I need to inject it into the VBScript engine that is running inside EA addins and not in EA directly.
-
Hi Barrie,
You ended up in the same dead-end as I did back then when I wrote EA-Matic.
I searched, but haven't found a way to get hold of the Session object.
So unfortunately EA-Matic scripts can't use the Session object.
To be honest, I haven't really missed it. I only ever use the Session object when debugging scripts, never in production.
Is there any specific reason you need the Session object?
Geert
-
Was for logging.
But can do that via Repository, and I've sent a pull request with the transmogrification of EA-Matic scripts for Session.ouput -> Repository equivalent.
-
Was for logging.
But can do that via Repository, and I've sent a pull request with the transmogrification of EA-Matic scripts for Session.ouput -> Repository equivalent.
Thanks, I'm a bit behind on the pull requests, but they are appreciated :)
Geert