Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: MWHBS on March 05, 2023, 07:34:40 am

Title: Something similar to VBA
Post by: MWHBS on March 05, 2023, 07:34:40 am
Hi

I just wanted to ask if there is something similar to VBA in Office that can be used to write one's own modifications for EA? Is there a starting point iike a tutorial ("Dear beginners, macros/extensions/whatever are built in the following programming language and you can use the following example to render a hello world message" etc)?

Best regards
Martin
Title: Re: Something similar to VBA
Post by: qwerty on March 05, 2023, 08:16:17 am
Well, you can use anything. Personally I use Python for lots of reasons. But that's up to everyone's taste. WSH works (I used that once), Perl (ditto), Java (well, not used but I know that people use it). You can as well go with compiled code (whatever you wish should do).

If you need a guide to EA's API you can look into my Scripting book. I once wrote that after struggling with what Sparx provided.

q.
Title: Re: Something similar to VBA
Post by: Geert Bellekens on March 05, 2023, 07:44:28 pm
You can use the internal scripting feature.

In the manual there are a few "hello world" type examples.

More complicated real-world stuff: https://github.com/GeertBellekens/Enterprise-Architect-VBScript-Library (https://github.com/GeertBellekens/Enterprise-Architect-VBScript-Library)

Geert
Title: Re: Something similar to VBA
Post by: MWHBS on March 06, 2023, 06:56:02 pm
Well, you can use anything. Personally I use Python for lots of reasons. But that's up to everyone's taste. WSH works (I used that once), Perl (ditto), Java (well, not used but I know that people use it). You can as well go with compiled code (whatever you wish should do).

If you need a guide to EA's API you can look into my Scripting book. I once wrote that after struggling with what Sparx provided.

q.

Thank you. Sounds good. If I could choose freely I would use Python. Where do I find that scripting book that you spoke off?
Title: Re: Something similar to VBA
Post by: MWHBS on March 06, 2023, 06:56:43 pm
You can use the internal scripting feature.

In the manual there are a few "hello world" type examples.

More complicated real-world stuff: https://github.com/GeertBellekens/Enterprise-Architect-VBScript-Library (https://github.com/GeertBellekens/Enterprise-Architect-VBScript-Library)

Geert

Thanks Geert

I will also take a look at this.

Best regards
Martin
Title: Re: Something similar to VBA
Post by: Sunshine on March 06, 2023, 08:42:49 pm
Depends on problem you are trying to solve.
For automating some tasks I use javascript which is built in. Note python support doesn't come out of the box. There is vbscript and jscript also out of box but they are becoming legacy.
If I need to extend functionality with a User Interface then I use c# with .net.
If you simply want to add extra attributes to elements in an existing modelling language like archimate the create an mdg.
Well there are a few options you can look into further. More details can be found in pdf library https://sparxsystems.com/resources/user-guides/16.1/index.html (https://sparxsystems.com/resources/user-guides/16.1/index.html)
Title: Re: Something similar to VBA
Post by: MWHBS on March 07, 2023, 12:29:40 am
I am sorry that I bothered you. Under tools there is only the Script Library and the Javascript console. I do not see a menu entry "Scripting". Most probably it has been deactivated. Would fit with the rest.

In  the library both, new group and new script, are grayed out ...
Title: Re: Something similar to VBA
Post by: Geert Bellekens on March 07, 2023, 12:36:08 am
I am sorry that I bothered you. Under tools there is only the Script Library and the Javascript console. I do not see a menu entry "Scripting". Most probably it has been deactivated. Would fit with the rest.

In  the library both, new group and new script, are grayed out ...
It's the script library you should be lookign at.

If you can't create any new scripts, that can be either a permission issue. (which you shouldn't encountered if you create a new local model and test it there), or a license issue.
You need at least the corporate edition to be able to use scripting.

Geert