Book a Demo

Author Topic: Invoking script from Add-In?  (Read 4237 times)

kjourdan

  • EA User
  • **
  • Posts: 71
  • Karma: +0/-0
    • View Profile
Invoking script from Add-In?
« on: August 07, 2017, 11:11:56 pm »
Is it possibly to invoke a user script from an Add-In?  I would like to add buttons to the user control for my add-in and have those buttons invoke scripts stored in the model.  Is this possible?

Helmut Ortmann

  • EA User
  • **
  • Posts: 970
  • Karma: +42/-1
    • View Profile
Re: Invoking script from Add-In?
« Reply #1 on: August 08, 2017, 01:30:18 am »
Hi,

yes.

In the Open Source Navigator https://bellekens.com/ea-navigator/ from Geert Belleken are classes which make it easy to implement invoking Scripts in your Addin.

My Open Source hoTools uses Geerts Script classes to call Scripts from within C# Add-In.


Kind regards,

Helmut
Coaching, Training, Workshop (Addins: hoTools, Search&Replace, LineStyle)

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13505
  • Karma: +572/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Invoking script from Add-In?
« Reply #2 on: August 08, 2017, 11:19:23 pm »
See https://github.com/GeertBellekens/Enterprise-Architect-Add-in-Framework/blob/master/EAAddinFramework/EASpecific/Script.cs for more info.
this is used in the tool EA-Matic to execute functions from scripts as a reaction to events from EA.

Just be careful not to include any of the EA specific stuff in the script you are trying to execute. So no "AS EA.Element" or no "Session.Input"  only "Repository" and "!INC" are supported by these scripts.

The best way forward is to start with a very simple example using nothing then standard scripting syntax, and then extend that step by step.

Geert