Author Topic: Something similar to VBA  (Read 2985 times)

MWHBS

  • EA User
  • **
  • Posts: 29
  • Karma: +0/-0
    • View Profile
Something similar to VBA
« 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

qwerty

  • EA Guru
  • *****
  • Posts: 13544
  • Karma: +395/-300
  • I'm no guru at all
    • View Profile
Re: Something similar to VBA
« Reply #1 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.
« Last Edit: March 05, 2023, 08:47:25 pm by qwerty »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13065
  • Karma: +544/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Something similar to VBA
« Reply #2 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

Geert

MWHBS

  • EA User
  • **
  • Posts: 29
  • Karma: +0/-0
    • View Profile
Re: Something similar to VBA
« Reply #3 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?

MWHBS

  • EA User
  • **
  • Posts: 29
  • Karma: +0/-0
    • View Profile
Re: Something similar to VBA
« Reply #4 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

Geert

Thanks Geert

I will also take a look at this.

Best regards
Martin

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1295
  • Karma: +119/-10
  • Its the results that count
    • View Profile
Re: Something similar to VBA
« Reply #5 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
Happy to help
:)

MWHBS

  • EA User
  • **
  • Posts: 29
  • Karma: +0/-0
    • View Profile
Re: Something similar to VBA
« Reply #6 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 ...

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13065
  • Karma: +544/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Something similar to VBA
« Reply #7 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