Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Ribeye on March 30, 2022, 09:26:33 pm

Title: Calling menu functions from C# - how to?
Post by: Ribeye on March 30, 2022, 09:26:33 pm
I am writing C# plugins using Visual Studio.

On my plugins menu I would like to have a menu item that triggers the Develop -> Data Modeling -> Import function.

How do you trigger standard EA menu items from C#?
 
Title: Re: Calling menu functions from C# - how to?
Post by: Geert Bellekens on March 30, 2022, 09:53:24 pm
You can't I'm afraid.

You can only use the API. Some of these menu options have an equivalent in the API, but certainly not all of them.

Geert
Title: Re: Calling menu functions from C# - how to?
Post by: Ribeye on March 30, 2022, 11:44:57 pm
Oh.

Can it be done in Javascript?

I cant find a way for that either.
Title: Re: Calling menu functions from C# - how to?
Post by: Geert Bellekens on March 31, 2022, 04:02:54 am
Oh.

Can it be done in Javascript?

I cant find a way for that either.
No, not in any language really, unless you want to use some kind of simulated click tool such as used for testen applications.

Not the best idea as that is usually really unstable and not reliable.

Geert
Title: Re: Calling menu functions from C# - how to?
Post by: Ribeye on March 31, 2022, 04:51:42 pm
I am thinking to assign key strokes to the menu functions using Start > View > Visual Style > Customize > Keyboard.

From C# you can send keystrokes, I see in the documentation.

Maybe that is an option.

Except I see not all menu options are available from "customise" form, so you cant assign a keyboard shortcut e.g.  Develop->Data Modelling -> Import
Title: Re: Calling menu functions from C# - how to?
Post by: Geert Bellekens on March 31, 2022, 05:24:30 pm
Even if it was an option it would be a half-assed cobbled together unreliable solution.

Might be good enough if you are the only user, but not really suitable as a professional solution.
You can ask sparx support if they know a solution to automating the data modelling import.
There might be an undocumented CustomCommand you can call, or else they can enter a feature request on your behalf.

Geert
Title: Re: Calling menu functions from C# - how to?
Post by: Ribeye on April 12, 2022, 02:20:09 am
Thanks Geert - they confirmed it is not implemented.