Author Topic: Running scripts from add-in?  (Read 3711 times)

Paulus

  • EA User
  • **
  • Posts: 152
  • Karma: +0/-0
    • View Profile
Running scripts from add-in?
« on: September 06, 2012, 08:34:47 am »
I would like to execute a script when certain events occur, like e.g. the EA_OnPreNewElement.

I know that the usual way to do this would be to create an add-in but i'm not that familiar with MS tooling like VS C#, or the C# language & libraries for that matter. I could make the effort to master this but i prefer not to and stick to writing VB/Javascript.

Has anyone tried something like this before, is there a way around MS VS/C#?






KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +54/-3
    • View Profile
Re: Running scripts from add-in?
« Reply #1 on: September 06, 2012, 09:03:32 am »
You can write add-ins in C++, Java, Delphi, Perl, anything that can create COM objects. I reckon that VB6 is the easiest language to write add-ins if you can find an old copy (MS stopped selling it many years ago). But if you are worried about the learning curve involved in writing C# add-ins, there is a working example in the resources section of this site somewhere that will give you a very good start.
The Sparx Team
[email protected]

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Running scripts from add-in?
« Reply #2 on: September 06, 2012, 04:20:39 pm »
Paulus,

I think the only way to use the events is to write an add-in.
I would really to be too afraid of it. C# is really a good language (pretty much the same thing as Java), and if you don't like VS you can use SharpDevelop (which is open source, free and a lot leaner then VS)
I've written some blog posts about creating add-in's for EA that might interest you:

Tutorial: Create your first C# Enterprise Architect addin in 10 minutes
The complete Enterprise Architect C# add-in template
Testing and debugging your Enterprise Architect C# Add-In
Tutorial: Deploy your Enterprise Architect C# add-in with an MSI package

Examples:
- Simple: MyAddin
- Complete: EA Navigator

I'm not sure though if or how you can run scripts from the add-in; I don't really use scripting.

Geert

Paulus

  • EA User
  • **
  • Posts: 152
  • Karma: +0/-0
    • View Profile
Re: Running scripts from add-in?
« Reply #3 on: September 06, 2012, 06:35:44 pm »
Thanks guys for the advice & samples! I'm going to look into it.

Still i think it would be a nice addition to EA if one could write scripts against all the events that are available to add-ins. I know it isn't rocket-science but writing scripts is a lot simpler since, apart from EA, you don't need any additional knowledge & tooling. I think that would be a big plus for companies that have more java-oriented ICT departments!

Any chance that there will be a future extension to the scripting capabilities of EA in that respect? I mean, a mechanism that allows for registering custom scripts to run in response to EA events?